Skip to content

Instantly share code, notes, and snippets.

@kalebo
kalebo / rsync_wrapper.py
Last active August 29, 2015 14:05
A wrapper for cwRsync to check that the correct drives are present before running
import sys
from ctypes import *
from datetime import datetime
import subprocess as subp
STD_OUTPUT_HANDLE_ID = c_ulong(0xfffffff5)
windll.Kernel32.GetStdHandle.restype = c_ulong
std_output_hdl = windll.Kernel32.GetStdHandle(STD_OUTPUT_HANDLE_ID)
@kalebo
kalebo / newhostsscan.py
Created August 14, 2014 18:24
A wrapper for nmap to search a range of ip ranges and report on the new hosts found
import nmap
import sys
from time import sleep
HOSTS= "192.168.1.1-255"
class ansicolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
@kalebo
kalebo / factcheck1.py
Last active August 29, 2015 14:05
A quick script to query WolfamAlpha for planet diameters to see if all the planets could really fit between the earth and the moon. Yes this is ugly code and it is overdoing it. See https://gist.github.com/4052828 for my inspiration.
import xmltodict
import urllib2
PLANETS = ["mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto"]
WA_KEY = "GETYOUR-OWNAPIKEY"
def query(q, key=WA_KEY):
return urllib2.urlopen('http://api.wolframalpha.com/v2/query?appid=%s&input=%s&format=plaintext' % (key,urllib2.quote(q))).read()
@kalebo
kalebo / pianobar_debian.sh
Last active May 19, 2017 16:07 — forked from cristianrasch/pianobar_debian.sh
Build commands for Pianobar (2014.06.08-dev) on Debian Jessie
# install the building dependencies
sudo aptitude install libevent-pthreads-2.0-5 libao-dev libgnutls-dev libmad0-dev libfaad-dev libjson0-dev libjson-glib-dev libavformat-dev libavfilter-dev
rm -rf ~/repos/pianobar
git clone git://github.com/PromyLOPh/pianobar.git ~/repos/pianobar
cd ~/repos/pianobar
make
# all set, you can run pianobar directly from the source directory, alternatively run this command to have it installed:
[sudo make install]
@kalebo
kalebo / dynamic_ip_tracker.py
Last active August 29, 2015 14:20
Dynamic IP Tracker
#!/usr/bin/python
# To add an an entry from a remote machine (NAME at LOCATION):
# $ echo "LOCATION::NAME" | telnet YOURSERVER 45667
import socket
from datetime import datetime
HOST = ""
@kalebo
kalebo / swapwin
Created June 16, 2015 16:32
swapwin
#!/bin/bash
##
# Example usage: swapwin firefox 1280
#
# Be sure to install wmctrl.
##
name=$1
location=$2
git clone --bare https://github.com/kalebo/dotfiles.git $HOME/.dotfiles
function gitdot {
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
mkdir -p .dotfiles-backup
gitdot checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";
@kalebo
kalebo / pptx2pdf.vbs
Last active September 20, 2016 02:31
Convert a directory of powerpoint slides to pdfs for lecture notes
'''
' This is a remixed VB script that I adapted from BillP3rd from stackoverflow.
' It expects a existing directory for output and powerpoint to be installed.
'
' Usage: cscript ppxt2pdf.vbs c:\Users\user\class_ppt_dir class_handouts_dir
'
' Also, I hate Visual Basic
'''
Option Explicit
@kalebo
kalebo / adgroupmembers.ps1
Created December 21, 2016 22:41
Select more info for each of the users in a AD group, sort and format
get-adgroupmember adgroupname | foreach {get-aduser $_.name | select name, surname, givenname} | sort-object surname | Format-Table -autosize
@kalebo
kalebo / kyleisms.json
Last active October 10, 2019 16:54
Kyle's kyleisms immortalized
[
"What do now guys?",
"Did I tell you about that time I got stuck in an elevator?",
"Life's hard when 'tarded.",
"So... Lunch?",
"Mornin. (said around 1pm)",
"Ooo, piece of candy!",
"It's brrzy outside.",
"It'll be super cute!"
]