Skip to content

Instantly share code, notes, and snippets.

View quarnster's full-sized avatar

Fredrik Ehnbom quarnster

  • Stockholm, Sweden
View GitHub Profile
// Download http://downloads.tatoeba.org/exports/sentences.tar.bz2 and http://downloads.tatoeba.org/exports/links.tar.bz2
// to this directory.
//
// Then run "go run tatoeba.go".
//
// Tweak "havestring" to change the 汉字 learned.
package main
import (
// GOOS=linux GOARCH=386 go build verify.go && ftp -u boxeebox:/tmp/ verify
//
// This tool verifies the boxeebox boot block, based on
// findings from running the "bootblockverifier" tool found
// in the boxeebox rma image (see http://www.boxeeboxwiki.org/rma).
//
// ##################### WARNING!!!! ######################
// # Whether it's possible to use this information to #
// # actually replace the current bootloader with a #
// # custom version is at the moment unknown. Use at #
@quarnster
quarnster / regs.py
Created April 5, 2014 13:47
small lldb script to print out details when sigaction is called
# lldb -o "script lldb.target" -o "command script import ./regs.py" -o "r" -o "c" python -- -c "print 'hello'"
# lldb -o "script lldb.target" -o "command script import ./regs.py" -o "r" -o "c" java Hello
import lldb
import re
r = re.compile("#define\s+(SIG[^_\s]+)\s+(\d+)")
f = open("/usr/include/sys/signal.h", "r")
sigs = dict(map(lambda a: (int(a.group(2),10), a.group(1)), map(r.search, filter(r.match, f.readlines()))))
f.close()
first = True
def breakpoint_callback(frame, bp_loc, dict):
import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0
ApplicationWindow {
id: window
property var lyrics: gocode.project.lyrics
width: 800
height: 600
property int scale: 1
Entering '3rdparty/bundles/GoSublime'
diff --git a/something_borrowed/src/gosublime.org/gocode/package.go b/something_borrowed/src/gosublime.org/gocode/package.go
index 9ac11dd..3d2b01f 100644
--- a/something_borrowed/src/gosublime.org/gocode/package.go
+++ b/something_borrowed/src/gosublime.org/gocode/package.go
@@ -3,13 +3,13 @@ package gocode
import (
"bytes"
"errors"
- "strings"
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <signal.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
@quarnster
quarnster / flash.go
Last active December 21, 2015 06:19
Go code for dumping the raw nandflash data from Boxeebox's /dev/spectra
// GOOS=linux GOARCH=386 go build flash.go && ftp -u boxeebox:/tmp/flash flash
package main
import (
"fmt"
"log"
"os"
"syscall"
"unsafe"
)
@quarnster
quarnster / steps.txt
Last active December 20, 2015 08:28
Boxee xbmc build stuff
Go to https://github.com/quarnster/boxeebox-xbmc instead.
@quarnster
quarnster / fetch.js
Created June 1, 2013 18:44
Small javascript for fetching all files in a document.
var re = new RegExp("download|subtitle.*srt|class_resources|slides")
for (var i in document.links)
{
var link = document.links[i].href;
if (re.test(link)) {
window.open(link);
}
}
@quarnster
quarnster / nn.hs
Created January 24, 2013 19:20
Neural Network in Haskell with some memory usage wierdness
-- Compile with ghc -O2 -msse4.2 --make nn -rtsopts
-- Run with ./nn False +RTS -s
-- .....
-- 812,842,896 bytes allocated in the heap
-- 592,620,616 bytes copied during GC
-- 63,771,584 bytes maximum residency (11 sample(s))
-- 1,063,968 bytes maximum slop
-- 180 MB total memory in use (0 MB lost due to fragmentation)
--
-- Tot time (elapsed) Avg pause Max pause