Skip to content

Instantly share code, notes, and snippets.

View raws's full-sized avatar
🥯
dabbling in pumpernickel

Ross Paffett raws

🥯
dabbling in pumpernickel
View GitHub Profile
@raws
raws / downcase.sh
Created July 15, 2012 17:12
Bash helper script for recursively lowercasing file names
#!/bin/bash
#
# downcase PATH
#
# Recursively convert all file names contained in the given directory
# tree (but excluding the given directory itself) to lowercase.
# Existing files which are named identical to new, lowercased file
# names will be clobbered.
#
# Author: Ross Paffett <ross@rosspaffett.com>
require 'socket'
require 'timeout'
class MCQuery
MAGIC_PREFIX = "\xFE\xFD"
PACKET_TYPE_CHALLENGE = "\x09"
PACKET_TYPE_QUERY = "\x00"
ID = "\x00\x00\x00\x00"
DEFAULTS = {
host: "localhost",
@raws
raws / appify
Created May 11, 2013 23:06 — forked from mathiasbynens/appify
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@raws
raws / slugs.rb
Created December 25, 2012 01:53 — forked from bkerley/slugs.rb
> ruby slugs.rb
id: 1639513188
enciphered output, string-escaped for your convenience:
"X\xD0\x97N"
slug: lt1krc
decrypted id: 1639513188
the same?
true
@raws
raws / bijective.rb
Created December 25, 2012 00:58 — forked from zumbojo/bijective.rb
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join
@raws
raws / curl.md
Created December 9, 2012 15:38 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@raws
raws / create-git-repo.sh
Created July 15, 2012 06:17
Bash helper script for creating a Git repository on systems hosting them
#!/bin/bash
#
# create-git-repo
#
# Create and publish a Git repository so that it is able to be
# cloned via `git clone git@host:repo.git'.
#
# Author: Ross Paffett <ross@rosspaffett.com>
GIT_DATA="/var/git" # Where to store the actual git repositories
scope :module => "Api::V2" do
scope :path => "api/v2" do
resources :users
end
end
scope :module => "Api::V1" do
scope :path => "api/v1" do
resources :users
end
@raws
raws / gist:1861817
Created February 19, 2012 03:32
Spoutcraft development Rake tasks
# Spoutcraft development Rake tasks
# Usage: rake -T
#
# These tasks assume the following folder structure:
# spoutcraft/
# lib/
# spoutcraft-api.jar A compatible SpoutcraftAPI package
# mcp/ Minecraft Coder Pack
# conf/ Symlink to ../conf
# lib/ Symlink to ../lib
@raws
raws / gist:1580909
Created January 9, 2012 03:41
Minecraft survival server block data

BuildCraft

143.0   Oil

RedPower

Flax