Skip to content

Instantly share code, notes, and snippets.

View boarpig's full-sized avatar

Lauri Hakko boarpig

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@boarpig
boarpig / main.go
Last active August 29, 2015 14:23
package main
import (
"unsafe"
"github.com/veandco/go-sdl2/sdl"
)
func main() {
const w = 640
@boarpig
boarpig / raid_simulation.ipynb
Last active August 29, 2015 14:11
Game simulation for a given raid group
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@boarpig
boarpig / gist:8118854
Created December 24, 2013 23:45
How to get plugin-container's cpu usage percent with python. This currently only handles one plugin container so your mileage may vary. You'll have to find your own cpu usage threshold if you actually want to use this to monitor if someone is actually watching a video or if it's just sitting still **further improvements:** You could use sh modul…
#!/usr/bin/python
#
# Based on answer from
# http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux
#
from time import sleep
import os
import os.path
import sys
@boarpig
boarpig / gist:7829707
Created December 6, 2013 18:21
Check if file exists in go
if _, err := os.Stat(filename); os.IsNotExist(err) {
fmt.Printf("no such file or directory: %s", filename)
return
}
#!/usr/bin/python
from PIL import Image
import argparse
import os
def main():
parser = argparse.ArgumentParser(description="Resave jpeg files multiple times")
parser.add_argument("-n", "--number", default=500, type=int,
help="Number of resaves, default: 500")
#!/usr/bin/python
import pyglet
from pyglet.window import key
from time import time, strftime, localtime
running = False
begin, now, total = 0, 0, 0
size = (320, 240)
format = "%.2f"