This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import math | |
# from here: https://gist.github.com/rochacbruno/2883505 | |
def distance(origin, destination): | |
lat1, lon1 = origin | |
lat2, lon2 = destination | |
radius = 6371 # km | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./xephyrize 2bwm|dwm|cwm|tinywm | |
# Define a simple X session | |
function x_session() { | |
sleep 1; | |
$@ & | |
xterm & | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DESKS=( ' one ' ' two ' ' three ' ' four ' ' five ' ) | |
battery() { | |
acpi --battery | \ | |
awk -F, '{print $2}' | |
} | |
dual_date() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from contextlib import closing | |
from hashlib import sha1 | |
import sys | |
import urllib2 | |
def hash_page(content): | |
page_hash = sha1() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import csv | |
# Ad hoc names for the fields from the source CSV | |
WAUDITFIELDS = ( 'id', | |
'type', | |
'facility', | |
'date', | |
'empty?', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP-CAS library. | |
*/ | |
require_once "CAS/CAS.php"; | |
/** | |
* d2l SSO library. | |
*/ | |
require_once "d2l-login.php"; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sysmouse will work with the trackpoint and trackpad, so enable | |
moused_enable="YES" | |
# Power saving features to keep it from getting ridiculously hot | |
powerd_enable="YES" | |
# you'll need to `pkg install drm-510-kmod` | |
kld_list="i915kms" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Get all git projects advertised on a cgit index as submodules for a repo. | |
Usage: | |
./scrape_cgit_repos.py http://git.example.com ./repos | |
""" | |
from bs4 import BeautifulSoup as soupy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# enable job control | |
set -m | |
TOR_PKGS=(tor-browser-gnu-linux-x86_64-2.3.25-8-dev-en-US.tar.gz{,.asc}) | |
TOR_MIRROR='https://www.torproject.org/dist/torbrowser/linux/' | |
# never hurts to double check this | |
TOR_SIGNING_KEY='416F061063FEE659' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
USERNAME='' | |
PASSWORD='' | |
THRESHOLD='1000' | |
SLO_THREADS=$(mysqladmin -u$USERNAME -p$PASSWORD proc | egrep -v 'Sleep|Time|Id|processlist' | awk -F'|' '{print $7,$2,$9}' | sort -bnr | sed '/^[ \t\n]*$/d' | head -5 ) | |
date | |
while read -r line; do |