Skip to content

Instantly share code, notes, and snippets.

View ralphsaunders's full-sized avatar

Ralph Saunders ralphsaunders

View GitHub Profile
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Hagrid {
final static List<String> compass = new ArrayList<>(Arrays.asList("N","E","S","W"));
public static void main(String[] args) {
File root = new File("C:/Users/.../Desktop/Hedge Maze");
@ralphsaunders
ralphsaunders / ginn.js
Last active January 3, 2016 21:29 — forked from seanmtracey/ginn.js
var ginn = (function(){
window.addEventListener('scroll', function(e) {
document.body.scrollHeight = e.pageY + 100000 + 'px';
});
window.dispatchEvent(scroll);
})();
core.chunk = function (array, chunkSize) {
/// <summary>
/// Splits a given array into separate arrays of the given chunkSize
/// </summary>
/// <param name="array" type="array"></param>
/// <param name="chunkSize" type="number"></param>
/// <returns type="array"></returns>
var count = 1;
var newArray = [];
var limit = chunkSize;
@ralphsaunders
ralphsaunders / Borked.md
Created November 6, 2012 02:25
I borked Postgresql
ralph:~ ralphsaunders$ sudo psql postgres -c 'CREATE EXTENSION "adminpack";'
Password:
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

ralph:lib ralphsaunders$ ps auxw | grep postgres
    ralphsaunders  87696   0.0  0.0  2455456    592   ??  Ss    2:16am   0:00.08 postgres: writer process       
    ralphsaunders  87695   0.0  0.0  2455456    552   ??  Ss    2:16am   0:00.00 postgres: checkpointer process       

ralphsaunders 87693 0.0 0.2 2455456 6300 ?? S 2:16am 0:00.02 /usr/local/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log

@ralphsaunders
ralphsaunders / errors.md
Created November 6, 2012 01:31
I broke Homebrew
ralph:~ ralphsaunders$ brew install postgresql
==> Downloading http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.bz2
Already downloaded: /Users/ralphsaunders/Library/Caches/Homebrew/postgresql-9.2.1.tar.bz2
==> Patching
patching file src/pl/plpython/Makefile
patching file contrib/uuid-ossp/uuid-ossp.c
==> ./configure --prefix=/usr/local/Cellar/postgresql/9.2.1 --datadir=/usr/local/Cellar/postgresql/9.2.1/share/postgresql --docdir=/usr/local/C
checking for inflate in -lz... no
configure: error: zlib library not found

If you have zlib already installed, see config.log for details on the

@ralphsaunders
ralphsaunders / errors.md
Created November 6, 2012 01:31
I broke Homebrew

ralph:~ ralphsaunders$ brew install postgresql ==> Downloading http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.bz2 Already downloaded: /Users/ralphsaunders/Library/Caches/Homebrew/postgresql-9.2.1.tar.bz2 ==> Patching patching file src/pl/plpython/Makefile patching file contrib/uuid-ossp/uuid-ossp.c ==> ./configure --prefix=/usr/local/Cellar/postgresql/9.2.1 --datadir=/usr/local/Cellar/postgresql/9.2.1/share/postgresql --docdir=/usr/local/C checking for inflate in -lz... no configure: error: zlib library not found If you have zlib already installed, see config.log for details on the

@ralphsaunders
ralphsaunders / directory_structure.txt
Created July 10, 2012 20:51
An example directory structure turned into HTML by payload.
|~posted/
|~articles/
|~an-article/
|-index.html
|-image.png
`-styles.css
|~another-article/
|-index.html
`-styles.css
|~portfolio/
@ralphsaunders
ralphsaunders / stupid.php
Created June 12, 2012 21:31
PHP preg_grep() throws a notice when passed array
/**
* This is my array, let's call him larry
*
* array(1) {
* ["canvas-snake"]=>
* array(5) {
* ["name"]=>
* string(12) "canvas-snake"
* ["server_path"]=>
* string(48) "/Applications/MAMP/htdocs/pl/posted/canvas-snake"
@ralphsaunders
ralphsaunders / colorwires.py
Created May 17, 2012 08:02
MCEdit filter for colour coding redstone circuits in Minecraft
# Authored by Seth Bling
# http://www.youtube.com/watch?v=3YaoSAaou7U
def perform(level, box, options):
groups = RedstoneGroups(level)
for x in xrange(box.minx, box.maxx):
for y in xrange(box.miny, box.maxy):
for z in xrange(box.minz, box.maxz):
groups.testblock((x, y, z))
@ralphsaunders
ralphsaunders / hn.user.js
Created May 14, 2012 17:29
Hacked News Userscript, for a better Hacker News
// ==UserScript==
// @name Hacked News
// @match https://news.ycombinator.com/*
// @match http://news.ycombinator.com/*
// @description For a tidier Hacker News
// @version .01
// ==/UserScript==
var css = '<style type="text/css">'
// Wildcards