Skip to content

Instantly share code, notes, and snippets.

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

Ian Foster lanrat

😎
👨‍💻
View GitHub Profile
@lanrat
lanrat / cb-exit
Created May 25, 2013 18:35
A modification to the cb-exit script in CrunchBang Linux to allow Hibernate
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
class cb_exit:
def disable_buttons(self):
@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 / crop.sh
Created April 17, 2014 02:31
script to crop PDFs with briss
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BRISS="${DIR}/briss-0.9-sakin-1/briss-0.9.jar"
JPATH="$(which java)"
#get list of all non-cropped PDFs
pdfs="$(find ${DIR} -type f -name "*.pdf" | grep -v "cropped")"
#number of documents cropped
count=0
@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()
@lanrat
lanrat / smtp-revoke.sh
Last active April 9, 2018 19:02
Check SMTP server revocation status
#!/usr/bin/env bash
if [ "$#" -eq 0 ];
then
echo "pass host to scan"
exit 1
fi
server=$1
mxserver=`dig mx $server +short 2>/dev/null | tail -1 | cut -d ' ' -f2`
#!/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