Skip to content

Instantly share code, notes, and snippets.

View mjard's full-sized avatar

Michael Jard mjard

  • Misadventure Games
View GitHub Profile
@mjard
mjard / blah.go
Last active December 12, 2015 03:18 — forked from sirpengi/blah.go
package main
func modify (myarr *[]int) ([]int) {
return append(*myarr, 4)
}
func main() {
arr := []int{}
arr = append(arr, 1)
arr = append(arr, 2)
import requests
import time
def getReddit(subreddit):
request = requests.get("http://reddit.com/r/%s/.json" % subreddit)
return request.json()['data']['children']
seen_ids = set()
while True:
@mjard
mjard / punchbotv3.gridlang
Last active December 11, 2015 04:19
it's like punchbot is getting smarter...
# maybe we bit off more than we could chew
@start
push 0
push @stackguard
call
push @fullsweep
call
push 1
@mjard
mjard / bot.gridlang
Last active December 11, 2015 02:08
PunchBot Fork, Punching in multiple directions!
# maybe we bit off more than we could chew
@STEPSIZE 12
@start
# []
push @fullsweep
# [@fullsweep]
call
# []
@mjard
mjard / bot.gridlang
Last active December 10, 2015 20:49
is it a bot yet?
# maybe we bit off more than we could chew
store GRIDSIZE << 12
<< GRIDSIZE
@start
minus << 1
dup
equal << 0
iftgoto << @up
@search
@mjard
mjard / bench_interfaces.go
Created December 12, 2012 20:30
Benchmarking Go Interfaces
package main
import (
"testing"
)
func Nop() {
}
type Stupid interface {
@mjard
mjard / httpd_sample.go
Created November 26, 2012 09:06
Few things to benchmark
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
# kaptin, safe from desg
def map(source, func):
return __builtins__.map(func, source)
# sixthgear
def mop(source, func):
return map(func, source)
# pythonic
def map(source, func):
# pythonic
def map(source, func):
dest = []
for x in source:
dest.append(func(x))
return dest
# list comprehension
def map(source, func):
return [func(x) for x in source]
@mjard
mjard / intro.txt
Created March 5, 2012 00:32
Gist Spie
This is the first iteration of a helpful gist irc roebit.
Try the following commands:
!gists - lists the last 5 gists pasted in the channel
!gists kaptin - list the last 5 gists pasted by kaptin
!search <search term> - search the last 5 gists with the search terms in the description
I'm welcome to questions and suggestions.
-Kaptin