Skip to content

Instantly share code, notes, and snippets.

View piksel's full-sized avatar
📠

nils måsén piksel

📠
View GitHub Profile
@piksel
piksel / wimp_view.js
Created April 17, 2012 22:35
Greasemonkey script for nice full screen view of wimp.com
// ==UserScript==
// @name Wimp Viewer
// @namespace http://piksel.se
// @version 0.1
// @description enter something useful
// @match http://www.wimp.com/*/
// @copyright 2012+, Nils Måsén
// ==/UserScript==
setTimeout(function(){
@piksel
piksel / svtplay-vlc.js
Created April 17, 2012 22:39
Greasemonkey script for adding links for watching SVTPlay in VLC and/or downloading
// ==UserScript==
// @name SvtPlay VLC Link
// @namespace http://piksel.se
// @version 0.2
// @description Adds links for watching in VLC and/or downloading
// @match http://*svtplay.se/t/*
// @copyright 2012+, Nils Måsén
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
// ==/UserScript==
@piksel
piksel / raspi-motd.sh
Created June 30, 2012 12:15
Script for setting a nice raspberry pi logo as MOTD on debian.
#!/bin/bash
logo="$(tput setaf 2)
.~~. .~~.
'. \ ' ' / .'$(tput setaf 1)
.~ .~~~..~. $(tput sgr0) _ _ $(tput setaf 1)
: .~.'~'.~. : $(tput sgr0) ___ ___ ___ ___| |_ ___ ___ ___ _ _ ___|_|$(tput setaf 1)
~ ( ) ( ) ~ $(tput sgr0) | _| .'|_ -| . | . | -_| _| _| | | | . | |$(tput setaf 1)
( : '~'.~.'~' : ) $(tput sgr0) |_| |__,|___| _|___|___|_| |_| |_ | | _|_|$(tput setaf 1)
~ .~ ( ) ~. ~ $(tput sgr0) |_| |___| |_| $(tput setaf 1)
@piksel
piksel / Handlebars.sublime-build
Created November 8, 2012 10:06
build system for handlebars compiling in sublime text 2
{
"selector": "source.handlebars",
"cmd": ["handlebars", "$file", "-f", "$file_path/../js/$file_base_name.handlebars.js"],
"windows": {
"cmd": ["handlebars.cmd", "$file", "-f", "$file_path/../js/$file_base_name.handlebars.js"]
},
"variants": [
{
@piksel
piksel / ocstat
Last active August 14, 2017 01:47
overclocking status for the raspberry pi shell script
#!/bin/bash
#
# ocstat - overclocking status for the raspberry pi
#
# relies on bc for calculations, if you get a command not found error, run:
# sudo apt-get install bc
#
echo -n " Freq: "
cat /boot/config.txt | grep _freq | tr -t '\n' ' ' | sed 's/_freq//g'
@piksel
piksel / gist:5128208
Created March 10, 2013 11:19
/r/sublimetext css tabified
body {
background-color:#1d1f20;
color:#d0d2d2
}
#header {
background-image:url(http://d.thumbs.redditmedia.com/jGRlerR8rxRx4jp3.png);
background-repeat:repeat-x;
background-position:bottom left;
background-color:#383838;
border:none
echo "main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}" | gcc -x c - && ./a.out | aplay
@piksel
piksel / gist:6019242
Created July 17, 2013 09:51
Function for pretty-printing integers, placing spaces every third digit from the end.
var _f = function(i){
var s = new String(i);
var r = '';
for(c = s.length-1; c >= 0; c--){
r = s[c] + r
if(c !== 0 && (s.length-c) % 3 === 0) r = ' ' + r
}
return r;
}
@piksel
piksel / säg.sh
Created August 9, 2013 08:04
Say stuff in swedish, using googles speech engine
#!/bin/bash
URL_PRE="https://translate.google.com/translate_tts?tl=sv&ie=UTF-8&q="
USER_AGENT="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:22.0) Gecko/20100101 Firefox/22.0"
wget -q -U "$USER_AGENT" -O - "$URL_PRE$@$URL_POST" | mpg123 -q - &
@piksel
piksel / restart_if_oom.py
Created September 26, 2013 14:56
Code to restart the python script if it gets an OOM exception. Yes, this is the wrong way to handle memory leaks, but unfortunately they sometimes occur in libraries out of your control.
try:
main()
except MemoryError, e:
print("Out of memory! Restarting proces...")
os.execl(sys.executable, *([sys.executable]+sys.argv))