Skip to content

Instantly share code, notes, and snippets.

@dotsh
dotsh / reinstall_VPS_from_inside.sh
Last active April 21, 2024 10:16
DIY install debian on Oracle Cloud Infrastructure ( Free Tier )
# should works on any cloud-init enabled hypervisor (openstack.. )
# start from a ubuntu minimal install
# we need to shrink down the used space to move it in a tmpfs of 700MB
# make sure we are on the highest kernel, so we can delete all the others ...
sudo apt update && sudo apt upgrade -y && reboot
# ... reconnect
sudo apt install lsof
@jetsanix
jetsanix / ss.sh
Last active November 20, 2021 07:11
badvpn-tun2socks over shadowsocks
#!/bin/bash
LIBROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PKGPATH=$LIBROOT/../pkg
function ss::install() {
case $ARCHITECTURE in
x86_64)
apt-get update
apt-get install shadowsocks-libev build-essential cmake libssl-dev pkg-config libnspr4-dev libnss3-dev
systemctl stop shadowsocks-libev
@ukautz
ukautz / README.md
Last active February 10, 2021 12:30
Dump LDAP search result as JSON

What can you do with ldapsearch outputs? Not much. With JSON, though ..

# from LDAP search tool ...
ldapsearch -h 127.0.0.1 -p 10389 \
	-D "cn=me,ou=Acme,dc=local" -w 'mypa$$w00t" \
	-b "ou=machines,ou=Acme,dc=local" \
	-s sub "(objectclass=machine)"
@kobake
kobake / git-commit-size.sh
Created November 5, 2017 13:42
Calculate size of a git commit object.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: git-commit-size.sh <commit hash>" 1>&2
exit 1
fi
HASH=$1
ITEM_LIST="`git diff-tree -r -c -M -C --no-commit-id $HASH`"
@jsonn
jsonn / gandi.py
Created October 23, 2017 12:31
Basic Gandi LiveDNS client
#!/usr/bin/env python
import json
import requests
import sys
APIKEY = "xxx"
def create_domain_record(domain, name, rrtype, ttl, values):
r = requests.post("https://dns.api.gandi.net/api/v5/domains/%s/records" % domain,
@F30
F30 / gpg-list-ownertrust.py
Created September 27, 2017 10:02
List GPG Ownertrust
#!/usr/bin/env python3
import sys
import os
import gnupg
TRUST_LEVEL_MAP = {
'q': '???',
@mgoellnitz
mgoellnitz / snip.sh
Last active January 4, 2024 17:57
GitLab Snippet Command Line Tool
#!/bin/bash
#
# Copyright 2016-2021 Martin Goellnitz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@samael500
samael500 / handler.lua
Last active August 25, 2023 15:11
Validating payloads from GitHub webhooks with Nginx + Lua
-- luarocks install JSON4Lua
-- luarocks install luacrypto
local json = require "json"
local crypto = require "crypto"
local secret = '<MY SUPER SECRET>'
local event = 'push'
local branch = 'refs/heads/master'
@jayeye
jayeye / README.md
Created October 3, 2016 21:45
Setting up ISC dhclient on debian / ubuntu for prefix delegation

My ISP (Time Warner Cable) hands out IPv6 addresses with DHCPv6; it will delegate a /56 if asked. So long as I keep refreshing the lease, it won't renumber me. I have my cable modem set to bridge, and do all the firewalling, NATing, etc., on a Debian box. In what follows, eth0 is the internal interface.

The dhclient that ships with debian/ubuntu does not support asking for a prefix delegation, so I had to build one from sources.

#!/usr/bin/python
# coding=utf-8
from gi.repository import GObject
import sys
import dbus
import smtplib
import subprocess
from datetime import datetime
from dbus.mainloop.glib import DBusGMainLoop