Skip to content

Instantly share code, notes, and snippets.

View jameshfisher's full-sized avatar
🏠
Working from home

Jim Fisher jameshfisher

🏠
Working from home
View GitHub Profile
@jameshfisher
jameshfisher / splunk_enterprise_download_urls.md
Last active August 29, 2015 14:04
Splunk Enterprise download URLs
NOT THIS: http://www.splunk.com/page/download_track?file=6.1.2/splunk/linux/splunk-6.1.2-213098-linux-2.6-x86_64.rpm
THIS:     http://download.splunk.com/products/splunk/releases/6.1.2/splunk/linux/splunk-6.1.2-213098-linux-2.6-x86_64.rpm

i.e. take the file argument and prefix it with http://download.splunk.com/products/splunk/releases/

Works for:

  • 6.1.2/splunk/linux/splunk-6.1.2-213098-linux-2.6-x86_64.rpm
  • 6.1.2/universalforwarder/linux/splunkforwarder-6.1.2-213098-linux-2.6-x86_64.rpm
  • ...
@jameshfisher
jameshfisher / gist:77799ca0d96f5d475f1e
Created December 22, 2014 17:20
Elm: Wrong HTML element disappears in state transition
<!DOCTYPE HTML>
<html><head><meta charset="UTF-8"><title>Compiled Elm</title><style>html,head,body { padding:0; margin:0; }
body { font-family: 'Lucida Grande','Trebuchet MS','Bitstream Vera Sans',Verdana,Helvetica,sans-serif; }
a {
color: #1184CE;
text-decoration: none;
}
a:hover {
text-decoration: underline;
color: rgb(234,21,122);
@jameshfisher
jameshfisher / NonMonadicIO.hs
Created January 6, 2015 01:51
Non-monadic IO in Haskell
module NonMonadicIO where
import GHC.Base (returnIO, bindIO)
-- The IO API:
--
-- returnIO :: a -> IO a
-- bindIO :: IO a -> (a -> IO b) -> IO b
-- Here's a program which does nothing:
@jameshfisher
jameshfisher / 1gam.md
Last active August 29, 2015 14:13
One Game a Month plans

Non-Euclidean sokoban

Just like sokoban, except instead of being played on a 2d grid, it is played on graph-like structures with strange topologies (e.g. loops, mobius strips).

Randomness

Player must create as random a sequence as possible using the keyboard. Randomness is rewarded by pictures of random stuff.

@jameshfisher
jameshfisher / trie.go
Created May 15, 2010 19:05
A trie structure, storing []byte elements, implemented in Go
package trie
import (
"container/vector"
"sort"
)
// A 'set' structure, that can hold []byte objects.
// For any one []byte instance, it is either in the set or not.
type Trie struct {
@jameshfisher
jameshfisher / pearson.go
Created May 18, 2010 22:31
A Go implementation of Pearson hashing
package pearson
/* Get an initial hash value by passing in the length of the array. */
func Init(length int) (hash byte) { return byte(length % 256) }
/* Given the hash of a string S0..SN and the character SN+1,
get the hash of the string S0..SN+1.
*/
func FeedByte(oldhash byte, next byte) (newhash byte) {
/* The following table is the result of the pseudorandom order at
@jameshfisher
jameshfisher / rust_0.2_compile_segfault.bash
Created July 2, 2012 23:06
Segfault compiling Rust 0.2
james@bast:~$ cd /tmp/
james@bast:/tmp$ tar -xvf rust-0.2.tar.gz
rust-0.2/
rust-0.2/Makefile.in
rust-0.2/mk/
rust-0.2/mk/snap.mk
rust-0.2/mk/llvm.mk
rust-0.2/mk/docs.mk
rust-0.2/mk/platform.mk
rust-0.2/mk/install.mk
@jameshfisher
jameshfisher / NinetyNine.hs
Last active December 11, 2015 01:48
initial
module NinetyNine where
import Data.List (foldl')
-- Problem 1: Find the last element of a list.
myLast :: [a] -> a
myLast [] = error "myLast []"
myLast (x:xs) = foldl' (flip const) x xs
-- Problem 2: Find the last but one element of a list.
@jameshfisher
jameshfisher / Javaland.md
Last active January 2, 2016 07:29
Javaland

An introduction to Javaland

Javaland is notorious for its acronyms, inconsistent and redundant naming, bundling of multiple things into new definitions, circular definitions, and so on.

This file aims to reduce this incomprehensible mess into a set of succinct definitions. This should read like a dictionary, where all definitions only refer to prior definitions.

The JVM

Java bytecode refers to two things:

@jameshfisher
jameshfisher / ORM_constraints.md
Last active January 4, 2016 12:59
ORM correctness constraints

ORM correctness constraints

At an old workplace, we used the Hibernate ORM to map a class hierarchy to our relational database. Hibernate represents a class hierarchy in the following way. Let's say we have the tables:

abstract class A
class B extends A
class C extends A