Skip to content

Instantly share code, notes, and snippets.

View Luzifer's full-sized avatar

Knut Ahlers Luzifer

View GitHub Profile
@Luzifer
Luzifer / main.go
Created March 4, 2015 12:38
Migrate Etherpad-Lite from MySQL to Redis
package main
import (
"database/sql"
"fmt"
"gopkg.in/redis.v2"
_ "github.com/go-sql-driver/mysql"
)
@Luzifer
Luzifer / README.md
Created September 23, 2014 12:48
issh - CLI script to access an EC2 instance via SSH using the instance ID

Luzifer / issh

I was tired to search the IP for an autoscaling or ELB instance in the EC2 instances table, copy and then SSH to it so I wrote a small script to help me with this. The goal was to provide just the instance ID (and if required also username and port) to ssh into the instance.

Requirements

  • Python 2 (Tested 2.7)
  • boto

Demo

@Luzifer
Luzifer / README.md
Last active May 13, 2016 10:29
A simple clone of the Dashing-Milkman widget which does not require API access to the API but uses the non-event iCalendar whose URL you can get on your dashboard.

Preview

Description

A simple clone of the Dashing-Milkman widget which does not require API access to the API but uses the non-event iCalendar whose URL you can get on your dashboard.

Dependencies

@Luzifer
Luzifer / 001_usage.md
Last active August 21, 2021 18:13
Fish-Shell: Switch AWS environments

Fish-Shell: Switch AWS environments

How to use

  1. Set up the folder ~/.awsenv/ with the folder structure shown below
  2. Create a credentials.txt for every environment folder (see an example below)
  3. Ensure no other user than yourself can view those files
  4. Create the function set_aws in ~/.config/fish/functions/set_aws.fish (see an example below)
  5. Now load any environment using set_aws <environment> like set_aws private

File structure

@Luzifer
Luzifer / pullrequests.py
Last active August 29, 2015 13:57
Little script to list open pull-requests on GitHub across all repositories
#!/usr/bin/env python
# Get an own access token from https://github.com/settings/applications
# and put it here to get this script working
access_token = 'nopeyoucantgetmine'
import urllib, urllib2, json, os, sys
rows, columns = [int(elem) for elem in os.popen('stty size', 'r').read().split()]
@Luzifer
Luzifer / check_reboot_required.py
Last active January 2, 2016 10:29
Simple Nagios check for NRPE / PeriodicNoise to check whether an Ubuntu server required reboot
#!/usr/bin/env python
import apt, os, re, sys, subprocess
if os.path.exists('/var/run/reboot-required'):
print 'reboot-required marker file exists'
sys.exit(1)
kernels = []
@Luzifer
Luzifer / sendmail.aug
Created December 29, 2013 17:32
Augeas lens to parse /etc/mail/sendmail.conf file
(*
Module: Sendmail
Parses simple key = "value" conffiles
Author: Knut Ahlers <[email protected]>
About: License
This file is licenced under the LGPL v2+, like the rest of Augeas.
*)
@Luzifer
Luzifer / check_uberspace_balance.py
Last active August 5, 2018 20:01
Simple inofficial library to fetch Uberspace account data for monitoring money on account or whatever…
#!/usr/bin/env python2.7
from uberspace import *
import argparse, sys, math
ST_OK = 0
ST_WARN = 1
ST_CRIT = 2
ST_UNKN = 3
@Luzifer
Luzifer / collectWindows.applescript
Last active January 8, 2016 14:57
Collect OSX windows from not present screens to main
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
set screen_height to item 4 of _b
end tell
@Luzifer
Luzifer / traveltime.py
Last active December 23, 2015 17:49
Need a quick overview how long you will need by car from geolocation xx.xxxx,yy.yyyy to xx.xxxx,yy.yyyy? Just ask: python traveltime.py xx.xxxx,yy.yyyy xx.xxxx,yy.yyyy
#!/usr/bin/env python
import urllib, json, sys
if len(sys.argv) < 3:
print 'Usage: %s <lat,lon> <lat,lon>' % sys.argv[0]
sys.exit(2)
url = 'http://maps.googleapis.com/maps/api/directions/json?origin=%s&destination=%s&sensor=false' % (sys.argv[1], sys.argv[2])