Skip to content

Instantly share code, notes, and snippets.

View adrianlzt's full-sized avatar

Adrián López adrianlzt

View GitHub Profile
@c0d3kid
c0d3kid / revprox.go
Last active January 16, 2024 16:05 — forked from JalfResi/revprox.go
Simple reverse proxy in Go (forked from original to use a struct instead of a closure with ssl)
package main
import (
"crypto/tls"
"log"
"net/http"
"net/http/httputil"
"net/url"
)
@DavidBuchanan314
DavidBuchanan314 / panopto_dl.py
Last active June 22, 2023 22:21
Panopto video downloader
import requests
import json
import os
import youtube_dl
PANOPTO_BASE = "https://cardiff.cloud.panopto.eu"
"""
Place the value of your .ASPXAUTH token in the following variable
"""
@DazWilkin
DazWilkin / gcpiot_startup.sh
Last active December 25, 2021 12:40
Google Cloud IoT Core & Golang
echo "Installing Mosquitto (MQTT) client tools"
opkg update > /dev/null
opkg install mosquitto mosquitto-client > /dev/null
echo "Configure GCP Cloud IoT"
SERVICE_ENDPOINT="mqtt.googleapis.com:8883"
read -p "GCP Project ID : " PROJECT
read -p "GCP Region : " REGION
read -p "GCP IoT Registry ID: " REGISTRY
read -p "GCP IoT Device ID : " DEVICE
@Morreski
Morreski / timed_cache.py
Last active December 21, 2023 18:17
Python lru_cache with timeout
from datetime import datetime, timedelta
import functools
def timed_cache(**timedelta_kwargs):
def _wrapper(f):
update_delta = timedelta(**timedelta_kwargs)
next_update = datetime.utcnow() + update_delta
# Apply @lru_cache to f with no cache size limit
@tbondarchuk
tbondarchuk / gather_delegation.yml
Created September 29, 2016 09:37
ansible gather facts from another host
---
## works only on ansible >= 2.0
###### inventory:
# [group1]
# test-01
# [group2]
# test-02
- hosts: group2
tasks:
@brendangregg
brendangregg / chaintest.py
Last active May 26, 2023 09:55
chaintest
#!/usr/bin/python
#
# chaintest Summarize off-CPU time by kernel stack + 2 waker stacks
# WORK IN PROGRESS. For Linux, uses BCC, eBPF.
#
# USAGE: chaintest [-h] [-u] [-p PID] [-i INTERVAL] [-T] [duration]
#
# PLEASE DO NOT RUN THIS IN PRODUCTION! This is a work in progress, intended to
# explore chain graphs on Linux, using eBPF capabilities from a particular
# kernel version (4.3ish). This tool will eventually get much better.
@varemenos
varemenos / 1.README.md
Last active April 21, 2024 23:21
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@bradrydzewski
bradrydzewski / generate_docker_cert.sh
Last active May 27, 2024 15:59
Generate trusted CA certificates for running Docker with HTTPS
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \