Skip to content

Instantly share code, notes, and snippets.

View aallan's full-sized avatar

Alasdair Allan aallan

View GitHub Profile
@aallan
aallan / contacts.pl
Last active January 1, 2016 22:39
Perl script to match a list of US phone numbers to the leaked Snapchat database of phone numbers and user names. Run in the same directory as the schat.csv file, and another file called contacts.tel that contains a list of US phone numbers—one number per line in the file. Since the final two digits of the number are obscured in the leaked file, …
#!/usr/bin/perl
print "Reading schat.csv\n";
open ( my $schat, "<schat.csv") || die "Can't open schat.csv: $!";
my @snaps = <$schat>;
close($schat);
chomp( @snaps );
print "Reading contacts.tel\n";
open ( my $contacts, "<contacts.tel") || die "Can't open contacts.tel: $!";
@aallan
aallan / locations.pl
Last active January 1, 2016 22:39
Perl script to go through the leaked Snapchat database of phone numbers and user names, and divide it into separate CSV files split by location. Will create a file for each location in a locations/ subdirectory in the current working directory. Will report the totals for each location in CSV format.
#!/usr/bin/perl
use strict;
print "Reading schat.csv\n";
unless ( open ( FILE, "<schat.csv") ) {
print "Cannot open file for read\n";
exit;
}
@aallan
aallan / EthernetUdp.c
Created March 31, 2014 16:14
Mulitcast UDP patch for the EthernetUdp.c source code in Arduino Ethernet library.
/*
Add the following decleration to EthernetUdp.h directly after line 55
virtual uint8_t beginMulti(IPAddress, uint16_t);
then add the following code to the end of EthernetUdp.c
*/
@aallan
aallan / keybase.md
Created January 27, 2015 13:58
Keybase proof

Keybase proof

I hereby claim:

  • I am aallan on github.
  • I am aallan (https://keybase.io/aallan) on keybase.
  • I have a public key whose fingerprint is A2E0 84E9 5E95 B4CB 0562 7672 5CA0 5526 5413 2159

To claim this, I am signing this object:

@aallan
aallan / i2c_lcd_smbus.py
Created August 24, 2015 18:36
Prints the current IP address to the SainSmart I2C 16×2 LCD panel using the ThinkBowl I2C library
import smbus
from time import *
# Older version of library that uses smbus, no longer updated
# For new projects use i2c_lcd
class i2c_lcd:
# Commands
CMD_Clear_Display = 0x01
@aallan
aallan / dual_ip.py
Last active September 5, 2015 18:29
Prints the current IP address for eth0 and eth1 to the SainSmart I2C 16×2 LCD panel using the ThinkBowl I2C library
#!/usr/bin/python
import socket
import fcntl
import struct
from i2clibraries import i2c_lcd_smbus
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
@aallan
aallan / i2c_scanner.ino
Last active September 20, 2015 16:28
Arduino sketch that scans the I2C bus for devices.
#include <Wire.h>
// i2c_scanner
// Version 1
// This program (or code that looks like it) can be found in many places. For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26 2013
// V3 by louarnold
@aallan
aallan / drmcheck.py
Created November 15, 2015 18:42
Python script to check encryption status of various types of ebook formats.
#!/usr/bin/python
#
# Changelog
# 1.00 - Initial version, with code from various other scripts.
# 1.01 - Moved authorship announcement to usage section.
# Written in 2011 by Paul Durrant
#
# 1.02 - Added recognition of Apple Fairplay encryption.
# Modified in 2015 by Alasdair Allan
#
@aallan
aallan / 0_get_beacon_json.sh
Last active January 7, 2016 20:17
The CES 2016 Beacons
curl -H 'Authorization: Token token=a00723c600c97d3aa96ad13475252be945cb1f0539b54ed4f66f9a0dcd18ae0b' https://proximitykit.radiusnetworks.com/api/kits/4276 > file.json
@aallan
aallan / speedtest-ifttt.sh
Last active May 29, 2022 15:50
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)