Skip to content

Instantly share code, notes, and snippets.

View Slackwise's full-sized avatar
🛸
Evangelizing Lisp

Adam Flanczewski Slackwise

🛸
Evangelizing Lisp
View GitHub Profile
@Slackwise
Slackwise / csv_to_json.rb
Created January 29, 2014 20:25
Converts a list of .csv files to .json files.
#!/usr/bin/env ruby
#
# Converts a list of .csv files to .json files.
require 'csv'
require 'json'
require 'pathname'
ARGV.each do |filename|
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@Slackwise
Slackwise / fizzbuzz.clj
Created December 19, 2014 15:46
FizzBuzz in Clojure from an HN comment. (So clean!)
;; From https://news.ycombinator.com/item?id=8772229
(defn divisible? [x y]
(zero? (rem x y)))
(defn fizzbuzz [n]
(cond (divisible? n 15) "Fizzbuzz"
(divisible? n 3) "Fizz"
(divisible? n 5) "Buzz"
:else n))
@Slackwise
Slackwise / ricoh-login.js
Created January 2, 2015 15:56
This is from the login page for our Ricoh copier. (I wish I were joking.)
function encrypt() {
document.form1.userid.value = base64encode(document.form1.userid_work.value);
document.form1.password.value = base64encode(document.form1.password_work.value);
document.form1.userid_work.value = "";
document.form1.password_work.value = "";
}
@Slackwise
Slackwise / keybase.md
Created March 5, 2015 02:08
Verifying my GitHub identity for Keybase...

Keybase proof

I hereby claim:

  • I am Slackwise on github.
  • I am slackwise (https://keybase.io/slackwise) on keybase.
  • I have a public key whose fingerprint is 5F4F 28BF D807 A127 8C33 3600 A38C 998E 8324 CB8C

To claim this, I am signing this object:

@Slackwise
Slackwise / fizzbuzz.rb
Created June 1, 2015 17:29
FizzBuzz golf.
1.upto(100){|i|puts((n=((i%3<1?'Fizz':'')+(i%5<1?'Buzz':'')))==''?i:n)}
@Slackwise
Slackwise / JavaScript Katamari Damacy
Created March 12, 2011 01:38
Paste into your address bar and enjoy!
javascript:var h='http://ec2-50-17-2-177.compute-1.amazonaws.com/js/',i,n,ss=['http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js',h+'Renderables.js',h+'Game.js'];for(i=0;i<ss.length;i++){n=document.createElement("script");n.src=ss[i]+'?'+Date.now();document.head.appendChild(n);}
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
@Slackwise
Slackwise / DateTime.parse_ad_format.rb
Created April 4, 2013 15:00
Active Directory keeps track of time in 100 NS intervals (UTC) since January 1st, 1601. Had to write this quick parsing method so I can work with AD exported data.
class DateTime
def self.parse_ad_format(datetime)
datetime = datetime.to_i
datetime /= 10_000_000 # Convert nanoseconds to seconds
datetime -= 11_644_473_600 # Get the difference between 1600 and 1970
strptime(datetime.to_s, '%s')
end
end
@Slackwise
Slackwise / seven.sh
Last active December 24, 2015 06:19
Setting up a Windows 7 VM using qemu-kvm. This is the script I use to run it.
#!/bin/sh
name="Seven"
hdd="./seven_hdd.img"
ram="2048"
cpu="host"
vga="std"
cdrom="./Win7-Pro-64.iso" # Must be an ISO file
# cdrom="virtio-win-0.1-65.iso"