Skip to content

Instantly share code, notes, and snippets.

View fim's full-sized avatar

Serafeim Mellos fim

  • Planet Algol Industries
  • Planet B-818
View GitHub Profile
#!/usr/bin/env python
import random
import sys
balls = {}
bonus = {}
count = 0
ld = set()
bn = set()
@fim
fim / roonserver
Last active September 23, 2020 19:39
Roon server init script for daphile
#!/sbin/openrc-run
DAEMON_NAME="RoonServer"
DAEMON_EXECUTABLE="/opt/RoonServer/start.sh"
DAEMON_OPTIONS=""
DAEMON_HOMEDIR="/opt/RoonServer"
DAEMON_PIDFILE="/var/run/roonserver.pid"
DAEMON_LOGFILE="/var/log/roonserver.log"
INIT_SLEEPTIME="2"
@fim
fim / zoopla_cli.py
Last active May 1, 2019 09:01
zoopla api client
#!/usr/bin/env python3
from functools import wraps
import time
import click
import json as js
import requests
import urllib
import os
import hashlib
@fim
fim / google_auth.py
Created April 27, 2017 12:52
Authenticate with Google from python using 2 factor auth.
import mechanize
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class GoogleBrowser(mechanize.Browser, object):
def __init__(self, username, password, *args, **kwargs):
self.username = username
@fim
fim / keybase.md
Created February 11, 2015 13:28
keybase auth

Keybase proof

I hereby claim:

  • I am fim on github.
  • I am fim (https://keybase.io/fim) on keybase.
  • I have a public key whose fingerprint is 2EBA 7210 3C08 0E6D D0D5 522B D07F B11C FDF4 3ED4

To claim this, I am signing this object:

@fim
fim / restore_version.py
Created November 13, 2014 17:33
Get specific version of file from versioned bucket
#!/usr/bin/env python
import boto
import sys
conn = boto.connect_s3()
bid = -1
print "Select bucket to restore from:"
while bid < 0:
@fim
fim / lotto.py
Created September 30, 2014 18:43
UK lotto weighted probability generator
import random
import sys
balls = {}
bonus = {}
count = 0
ld = set()
bn = 0
def weighted_choise_sub(weights):
@fim
fim / tarsnapper
Last active August 29, 2015 13:58
Tarsnap script for daily machine backups
#!/bin/sh
CACHEDIR=${CACHEDIR:-/usr/local/tarsnap-cache}
RETENTION=${RETENTION:-7}
TARSNAP=/usr/local/bin/tarsnap
[ -z $@ ] && echo "No backup dirs specified" && exit 1
$TARSNAP --cachedir $CACHEDIR -c -f $(hostname -s)-$(date +%Y%m%d) $@
@fim
fim / gpxe_create.sh
Created March 5, 2014 14:49
Create pxe files for gentoo pxeboot using latest isos
# !/bin/bash -e
# Download a minimal install iso
# Prepare a TFTP Server
# Mount the ISO file as a loopback device (mount -o loop /path/to/install-x86-minimal-20100216.iso /mnt/cdrom/)
# Copy the Kernel (/mnt/cdrom/isolinux/gentoo) to your TFTP-Root
# Copy the InitramFS and the squash'ed root fs to a temp dir (/mnt/cdrom/isolinux/gentoo.igz and /mnt/cdrom/image.squashfs)
# Unpack the initramfs (gunzip -c gentoo.igz | cpio -idv)
# Patch the init script with this patch.
# Copy the RootFS to mnt/cdrom inside the initramfs (mkdir -p mnt/cdrom; cp image.squashfs mnt/cdrom/)
@fim
fim / gerrit
Last active August 29, 2015 13:56
Gerrit openrc init script
#!/sbin/runscript
depend() {
need net
}
get_config() {
if test -f "$GERRIT_CONFIG" ; then
if test "x$1" = x--int ; then
# Git might not be able to expand "8g" properly. If it gives