Skip to content

Instantly share code, notes, and snippets.

View lanrat's full-sized avatar
😎
👨‍💻

Ian Foster lanrat

😎
👨‍💻
View GitHub Profile
@lanrat
lanrat / LCDd.conf
Created February 17, 2016 21:59
LCDProc config
# LCDd.conf -- configuration file for the LCDproc server daemon LCDd
#
# This file contains the configuration for the LCDd server.
#
# The format is ini-file-like. It is divided into sections that start at
# markers that look like [section]. Comments are all line-based comments,
# and are lines that start with '#' or ';'.
#
# The server has a 'central' section named [server]. For the menu there is
# a section called [menu]. Further each driver has a section which
@lanrat
lanrat / letsencryptauth.conf
Last active January 26, 2016 22:19
letsencrypt nginx config
# Add this line inside the server block to enable this
#
# include /etc/letsencrypt/nginx/letsencryptauth.conf;
#
location /.well-known/acme-challenge {
#proxy_set_header Host $host;
#proxy_set_header X-Forwarded-For $remote_addr;
#proxy_set_header X-Forwarded-Proto https; #$scheme; # https
#proxy_set_header X-Real-IP $remote_addr;
@lanrat
lanrat / docker-recreate.go
Created January 19, 2016 19:41
Recreate a docker container with the same configuration after an image upgrade
package main
import (
"fmt"
"os"
"strings"
"github.com/fsouza/go-dockerclient"
//"github.com/tonnerre/golang-pretty"
)
@lanrat
lanrat / docker_backup.sh
Created January 7, 2016 21:17
Backup Docker container configurations and volumes
#! /usr/bin/env bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DATE=$(date +%Y-%m-%d)
BACKUP_DIR=${DIR}/${DATE}
echo "Backing up containers"
mkdir -p $BACKUP_DIR/containers/
for container in $(docker ps -qa)
do
@lanrat
lanrat / acdcli.sh
Last active December 29, 2015 19:07
acd cli script
#! /usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
virtualenv -p python3 $DIR/acdcli_env > /dev/null
source $DIR/acdcli_env/bin/activate
export ACD_CLI_CACHE_PATH=$DIR/acd_cache
# uncomment this to install/upgrade
# pip3 install --upgrade git+https://github.com/yadayada/acd_cli.git > /dev/null
acdcli clear-cache
acdcli sync
CMD="acdcli upload --overwrite --max-retries 4 --max-connections 4"
@lanrat
lanrat / mboxpathparser.py
Created December 27, 2015 01:10
mbox parser
#!/usr/bin/env python
import mailbox
import sys
import base64
import string
import re
def dataDecode(data):
try:
@lanrat
lanrat / bandwidth.sh
Created December 21, 2015 20:40
DD-WRT SNMP bandwidth
#!/usr/bin/env bash
HOST=192.168.1.1
IFACE_ID=3
SAMPLE=5
## iface
NAME=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.2.$IFACE_ID | cut -d ' ' -f2)
echo "Bandwidth for $NAME"
## bytes
D1=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.10.$IFACE_ID | cut -d ' ' -f2)
U1=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.16.$IFACE_ID | cut -d ' ' -f2)
@lanrat
lanrat / cbz2pdf.sh
Created November 29, 2015 02:17
Convert CBZ to PDF
#! /usr/bin/env bash
help()
{
echo "Usage: $0 file.cbz"
}
run()
{
dir=`mktemp -d`
@lanrat
lanrat / http-https.go
Last active November 1, 2015 04:54
Serve HTTP & HTTPS on same port example
package main
import (
"crypto/tls"
"fmt"
"io"
"log"
"net"
"net/http"
"net/url"
@lanrat
lanrat / ascii.txt
Last active October 3, 2015 22:14
Tiamat’s Eye
firsttolocatethehouseofbearjesterwinsafreec3ticket