Skip to content

Instantly share code, notes, and snippets.

@andrewjkerr
andrewjkerr / queue_submissions.rb
Last active November 25, 2018 20:28
A small lil' script to properly format, tag, and queue submissions for a popular Tumblr blog that I run.
require 'tumblr_client'
client = Tumblr::Client.new({
consumer_key: 'TUMBLR_CONSUMER_KEY',
consumer_secret: 'TUMBLR_CONSUMER_SECRET',
oauth_token: 'TUMBLR_OAUTH_TOKEN',
oauth_token_secret: 'TUMBLR_OAUTH_TOKEN_SECRET'
})
submissions = client.submissions('dogs.tumblr.com')
@andrewjkerr
andrewjkerr / draft_reblogs_from_tag.rb
Created November 30, 2016 06:20
A super quick and dirty script to draft a bunch of posts based on a certain tag.
require 'tumblr_client'
# Get dat Tumblr client
client = Tumblr::Client.new({
consumer_key: 'CONSUMER_KEY',
consumer_secret: 'CONSUMER_SECRET',
oauth_token: 'OAUTH_TOKEN',
oauth_token_secret: 'OAUTH_TOKEN_SECRET'
})
@andrewjkerr
andrewjkerr / mac_printer.rb
Created May 9, 2016 20:50
Prints the MAC addresses of captured packets
require 'pcaprub'
snaplength = 65535
promiscous_mode = true
timeout = 0
capture = PCAPRUB::Pcap.open_live('en0', snaplength, promiscous_mode, timeout)
capture.each_packet do |packet|
mac = packet.data.unpack("C*").
@andrewjkerr
andrewjkerr / ruby-factorial.rb
Created November 15, 2015 21:48
Ruby is great, isn't it?
# Accepts an integer n
# Returns the factorial of n
def fact(n)
return nil if n < 1
(1..(n.to_i)).reduce(:*)
end
import sys, hashlib, urllib2, re
def hash(s, salt):
#Welcome to the Space Jam
h = hashlib.sha256()
#Here's your chance do your dance at the Space Jam
h.update(s + salt)
#Alright
@andrewjkerr
andrewjkerr / tumblr-theme.html
Last active August 29, 2015 14:13
My semi-custom Tumblr theme.
<!DOCTYPE html>
<!--
Original Theme: Ashley v0.6
Original Author: Jxnblk [http://jxnblk.com]
For: Tumblr [http://tumblr.com/]
Terms: Protected under Creative Commons. [http://creativecommons.org/licenses/by-nc/3.0/]
Modified Theme: type v0.1
Modified Author: andrewjkerr [https://andrewjkerr.github.io]
@andrewjkerr
andrewjkerr / palindrome.rb
Last active August 29, 2015 14:09
Checks whether a string is a palindrome using recursion.
def palindrome str
str.split('')
if str.length <= 1
return true
elsif str.length == 2
return str[0] == str[1]
else
length = str.length
if str[0] == str[length-1]
return palindrome str[1..length-2]
@andrewjkerr
andrewjkerr / NumCount.java
Created October 25, 2014 22:00
Counts the number of occurances for all numbers 1-10 from user input.
/*
Class: CountNum
Author: Andrew J Kerr <me@andrewjkerr.com>
Summary: Counts the number of occurances for all numbers 1-10 from user input.
*/
import java.util.*;
public class CountNum
{

Keybase proof

I hereby claim:

  • I am andrewjkerr on github.
  • I am andrewjkerr (https://keybase.io/andrewjkerr) on keybase.
  • I have a public key whose fingerprint is 0994 7CE8 1AE7 2184 8A3D 58F9 2480 243C 99EB 20B2

To claim this, I am signing this object:

@andrewjkerr
andrewjkerr / cop4600fa14-project1-notes.md
Created September 8, 2014 14:04
Notes for Project #1 for COP4600 in Fall 2014.