Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View starkers's full-sized avatar

David Stark starkers

  • London, UK
  • 10:30 (UTC +01:00)
View GitHub Profile
@starkers
starkers / prune_old_vols.sh
Last active August 28, 2023 11:11
prune delete and remove old bacula volumes
#!/usr/bin/env bash
#set -x
# Prune and volumes older than 2 months:
PAST=`date --date='-2 months 0 day ago' +%Y-%m-%d`
#EG a hard coded date
#PAST="2012-11-29"
#PAST="2013-11-29"
@starkers
starkers / xpass
Last active May 17, 2021 17:41
generate password and copy it into clipboard
#!/usr/bin/env bash
# See: https://gist.github.com/starkers/234909caf153904e5428
#Check xpass exists
if [ ! -x "$(which xclip)" ]; then
echo "Please install xclip" ; exit 1
fi
#Length of string:
LEN=32

Keybase proof

I hereby claim:

  • I am starkers on github.
  • I am starkers (https://keybase.io/starkers) on keybase.
  • I have a public key ASC_Ud4t4I5_0Y_89PVC3yX9Ax8Hqr5BhOHYJIVcorsC9Qo

To claim this, I am signing this object:

@starkers
starkers / lxc-prep
Last active February 17, 2020 17:08
Install SSH keys into lxc containers
#!/usr/bin/env bash
if [ "X$1" == X ]; then
echo "prepares a new container does the following:"
echo "- installs ssh keys from $KEYS"
echo "- sets random root passwords"
echo "- deletes the 'ubuntu' user"
echo
echo "usage: 'lxc-prep <container_name>'"
echo
@starkers
starkers / wait-for
Created August 10, 2019 01:50
wait for http status code on an endpoint
#!/usr/bin/env python3
import logging
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
import argparse
import time
import sys
#!/usr/bin/env python3
import click
import requests
from datetime import datetime, timedelta
import sys
# current_time = dt.datetime.utcnow().isoformat() + 'Z'
# expire_time = "2020-12-12T12:00:00Z"
@starkers
starkers / make-bundle
Last active June 10, 2019 03:01
Generate a new client for OpenVPN, create a .ovpn file and bundle it into a zip
#!/usr/bin/env bash
# NB: I use this on centos 6 but should work on other stuff
#
# Ensure that reverse DNS works so it can lookup its IP/hostname
# Also relies on "zip" and dig
#
# ....I should probably do some more checks on:
# Destination folders existence
# client cert is correctly inserted into the index
# host lookup worked
@starkers
starkers / .vimrc
Last active May 11, 2019 20:51
minimal vimrc
"""" TLDR
" I use this for when I need to do some quick hacking/testing on an instance or whatever
""""
" install with:
"""""
" curl -L https://gist.github.com/starkers/53c4cec182dd55bc42ba9b0572cfe162/raw/cdba66ede29df6be6e7cd3371ea9596d7e09d94a/.vimrc > ~/.vimrc
""""
set nocompatible
filetype off
@starkers
starkers / new-wireguard.sh
Created February 1, 2019 14:13
simple script for wireguard
#!/usr/bin/env bash
## we know generating the client private here is bad.. but its quick n easy
FILE_MAIN=/etc/wireguard/wg0.conf
function list_existing_ips(){
grep ^AllowedIPs ${FILE_MAIN} | sed 's+\/32++g' | awk '{print $3}' | sort
}
@starkers
starkers / docker-compose.yml
Created October 24, 2018 12:46
production worthy gitlab, just snapshot the host daily..
---
version: '2'
services:
traefik:
image: traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik/traefik.toml:/etc/traefik/traefik.toml:ro