Skip to content

Instantly share code, notes, and snippets.

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

Ian Foster lanrat

😎
👨‍💻
View GitHub Profile
@lanrat
lanrat / ColorUtils.java
Created January 30, 2014 06:07
Lightpack Android API
package com.prismadroid.colors;
import java.util.Random;
public class ColorUtils
{
private static Random random = new Random(System.currentTimeMillis());
public static Rgb24 randomColor()
{
@lanrat
lanrat / psync.sh
Created April 2, 2014 21:58
ssh proxy rsync
REMOTE_USER=usename
REMOTE_HOST=source.com
REMOTE_PORT=22
REMOTE_DIR=folder
LOCAL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROXY_ENABLE=true
PROXY_USER=proxy-user
PROXY_HOST=proxy.host.com
@lanrat
lanrat / random.py
Created April 27, 2014 06:45
Print something random
#!/usr/bin/env python
import urllib2
import urllib
import re
def randomThing():
randomURL="http://en.wikipedia.org/wiki/Special:Random"
req = urllib2.Request(randomURL)
res = urllib2.urlopen(req)
finalurl = res.geturl()
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@lanrat
lanrat / xup.sh
Created May 28, 2014 23:51
script to update xrandr when monitor configuration changes
#!/bin/sh
CONNECTED_OUTPUTS=$(xrandr -q | grep "\Wconnected" | cut -d ' ' -f1)
DISCONNECTED_OUTPUTS=$(xrandr -q | grep "\Wdisconnected" | cut -d ' ' -f1)
disable()
{
for output in $DISCONNECTED_OUTPUTS;
do
xrandr --output $output --off
done
#!/usr/bin/env bash
USB_SERIAL="TODO"
START_CMD="xscreensaver -no-splash"
LOCK_CMD="xscreensaver-command --lock"
UNLOCK_CMD="killall xscreensaver"
LAST_SEEN=""
#return 1 if device is found, 0 otherwise
@lanrat
lanrat / cb-exit.py
Last active August 29, 2015 14:12 — forked from jaapz/cb-exit.py
A fork of cb-exit for crunchbang with support for Debian Jessie and Hibernate
#!/usr/bin/env python
# Replace the old /usr/bin/cb-exit with this one.
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
@lanrat
lanrat / 256color.pl
Created January 26, 2015 19:37
256 color term tester
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
@lanrat
lanrat / colors.sh
Created January 26, 2015 19:39
print common shell colors
#!/usr/bin/env bash
#this function was taken from:
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt#Colors_overview
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
@lanrat
lanrat / motd.sh
Last active August 29, 2015 14:19
Colord Figlet Hostname
h=$(hostname|figlet);c=$(($(hostname|wc -c)%6+1));echo "\033[3${c}m${h}\033[0m"