Skip to content

Instantly share code, notes, and snippets.

View DavidJRobertson's full-sized avatar

David Robertson DavidJRobertson

View GitHub Profile
class String
def last(n)
self[-n,n]
end
end
require "digest"
def hash_message(message)
sha256 = Digest::SHA2.new(256)
puts "XOR tool"
hexvals = Array.new
puts "Enter first value in hex: "
hexvals << gets.chomp
puts "Enter second value in hex: "
hexvals << gets.chomp
vals = Array.new
@DavidJRobertson
DavidJRobertson / dbss.cpp
Created April 13, 2012 06:33
Dropbox screenshot tool (rather cobbled together, basically imitates puush.me)
/* Dropbox Screenshot Tool Thingy
* ==============================
* David Robertson - http://davidr.me/
*
* Dependencies:
* - ImageMagick
* - Magick++
* - xclip (on linux - on a mac, be sure to change the COPY part of the settings below)
* - xdotool (required for taking screenshots of the active window only)
* - notify-send (for on-screen notification that a screenshot has just been taken)
@DavidJRobertson
DavidJRobertson / dcpu-asm.md
Created October 15, 2012 18:47
DCPU ASSEMBLER

Scroll down for assembler ruby source code

DCPU Assembler

Comments

Start with a # and can be on their own line or at the end of a line of code

Labels

require 'rubygems'
require 'tumblr_client'
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
config.consumer_secret = "SYfZQUh6kGgEG3zAtQwO9jJwGEDcVXBMRg1QUTRIMZqBqDHMUR"
end
tumblr = Tumblr.new
require 'rubygems'
require 'tumblr_client'
require 'active_record'
GIF_MAX_WIDTH = 1024
GIF_MAX_HEIGHT = 768
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
require 'rubygems'
require 'tumblr_client'
require 'uri'
GIF_MAX_WIDTH = 1024
GIF_MAX_HEIGHT = 768
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
Fags, Mags And Bags - S01 - E01 - Raising Keenan.mp3:
title: FMB S01 E01 Raising Keenan
date: 8 dec 2012
synopsis: Fags, mags and bags' first episode!
tags:
- fags
- mags
- bags
two.mp3:
title: Episode Two
#! /usr/bin/env ruby
require 'yaml'
require 'pp'
require 'erubis'
require 'mp3info'
require 'aws/s3'
require 'digest'
def reload_config
@DavidJRobertson
DavidJRobertson / gist:4260680
Created December 11, 2012 18:00
Ruby: pretty directory recursion :P
# EDIT: this can actually be done more simply like this:
Dir.foreach("path/to/directory/**/*") do |item|
next if File.directory? item
# Do whatever with item now
end
# Define this somewhere
def each_file(dir = ".", &block)
Dir.foreach(dir) do |item|