Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Weber scy

View GitHub Profile
@scy
scy / btrsnap
Last active Aug 29, 2015
a btrfs-based local snapshotting script (for timemachine-like fuckup recovery)
View btrsnap
Please see https://github.com/scy/scybtr/blob/master/btrsnap instead.
@scy
scy / utc.py
Created Apr 30, 2014
How to parse a string as UTC in Python
View utc.py
import datetime
class UTC(datetime.tzinfo):
ZERO = datetime.timedelta(0)
def utcoffset(self, dt):
return self.ZERO
def tzname(self, dt):
return 'UTC'
def dst(self, dt):
return self.ZERO
@scy
scy / gist:944031
Created Apr 27, 2011
Automatically close netzpolitik.org tabs with Linus Neumann posts
View gist:944031
" Add this to your .pentadactylrc:
autocmd -js DOMLoad netzpolitik.org if (doc.querySelectorAll('body.single-post .entry-meta a[href="http://www.netzpolitik.org/author/linus/"]').length) { content.window.close(); }
@scy
scy / _edit.html.erb
Created Sep 11, 2011
Initializing a jQuery UI autocomplete with data from a Rails array
View _edit.html.erb
<script type="text/javascript">
// Trying to help @gedankenstuecke here. A bit hard because I don’t speak Rails (neither Ruby) and can’t try live what the output looks like.
$(function () {
$("#<%=p.object.phenotype_id.to_json%>").autocomplete({
source: <%=Phenotype.find_by_id(p.object.phenotype_id).known_phenotypes.to_json%>
});
});
</script>
@scy
scy / jquery.pseudo.data.js
Last active Dec 21, 2015
A simple :data(key) selector for jQuery
View jquery.pseudo.data.js
// jQuery UI has a :data selector. I wanted to have it without including jQuery UI.
// To find out how all of this works, read the Sizzle documentation:
// https://github.com/jquery/sizzle/wiki/Sizzle-Documentation
// Thanks to @_Tomalak for inspiring me to check this out.
jQuery.expr.pseudos.data = jQuery.expr.createPseudo(function (key) {
return function (el) {
return !!jQuery.data(el, key);
};
});
@scy
scy / fix-expanded-svn-id.sh
Created Sep 12, 2012
Un-expand $Id$ in a git-svn repository, with some special powers
View fix-expanded-svn-id.sh
#!/bin/sh
# The problem:
#
# You have a clean git-svn working copy and, for example, rsync the files from
# the production server into it in order to find out whether some files have
# been changed directly on the server, without committing.
#
# However, the files on the production server possibly have $Id$ expanded, and
# now you're seeing a _lot_ of changed files which contain no differences except
@scy
scy / gw2-golang-poc.go
Last active Jan 2, 2019
Example on how to access the Guild Wars 2 Mumble Link API on Windows using Go. Not supposed to be good Go code, but it works.
View gw2-golang-poc.go
package main
import (
"fmt"
"log"
"syscall"
"time"
"unsafe"
"unicode/utf16"
"unicode/utf8"
@scy
scy / SuperCollider on Termux.md
Last active Sep 26, 2019
My attempt to build SuperCollider on Termux/Android
View SuperCollider on Termux.md

This was supposed to be posted on the SC forums at scsynth.org, but I ran into the spam filter and thus saved it as a Gist first. It's on the forums now: My attempt to build SuperCollider on Termux/Android

I've been thinking about using SuperCollider on my phone. There's glastonbridge/SuperCollider-Android which hasn't been touched since 2014, so I thought I'll try to build a current version from source, based on the guide for Linux. Also, since Termux provides a great Linux CLI environment, including build toolchains, directly on the device, I wanted to try building SC under Termux.

Spoiler alert: I didn't manage to do it. The main problem is not having an audio driver, since the Linux build requires libjack, and neither Android nor Termux provide it. (Termux has

@scy
scy / packets.txt
Last active Jan 11, 2020
Checksum of a proprietary RS485 protocol
View packets.txt
Packets with “?” may have a wrong checksum, I’m not sure about those.
Format of a packet seems to be:
1 start byte
3 bytes header (I don’t understand it yet)
1 byte payload length
n bytes payload
1 byte checksum
Interested in what else I found out? Check the project page:
@scy
scy / install-phantomjs.sh
Created May 21, 2014
Simple PhantomJS installer for Linux
View install-phantomjs.sh
#!/bin/sh
set -e
if [ "$(id -u)" -ne 0 ]; then
printf 'WARNING: You will most likely need to be root, but continuing anyway ...\n' >&2
fi
url="$1"
if [ -z "$url" ]; then
printf 'Please go to <http://phantomjs.org/download.html> and find the\n'
You can’t perform that action at this time.