Skip to content

Instantly share code, notes, and snippets.

View Mebus's full-sized avatar
😀

Mebus Mebus

😀
View GitHub Profile
@Mebus
Mebus / sc-dl.js
Created April 13, 2012 19:21
Bookmarklet that generates download link for a Soundcloud upload
(function(b) {
var a = b.createElement("a");
var s = b.createElement("span");
s.innerText = "Download";
a.appendChild(s);
a.href="http://media.soundcloud.com/stream/"+b.querySelector("#main-content-inner img[class=waveform]").src.match(/\.com\/(.+)\_/)[1];
a.setAttribute("class", "pl-button");
a.setAttribute("style", "background-image: url(http://soundcloud.com/images/icons_mini.png?unicorn26); background-repeat: no-repeat; padding-left: 18px; background-position: -77px -236px;");
a.download = b.querySelector("em").innerText+".mp3";
b.querySelector(".primary").appendChild(a);
// Written by Nick Gammon
// February 2011
/**
* Send arbitrary number of bits at whatever clock rate (tested at 500 KHZ and 500 HZ).
* This script will capture the SPI bytes, when a '\n' is recieved it will then output
* the captured byte stream via the serial.
*/
#include <SPI.h>
// Written by Nick Gammon
// February 2011
/**
* Send arbitrary number of bits at whatever clock rate (tested at 500 KHZ and 500 HZ).
* This script will capture the SPI bytes, when a '\n' is recieved it will then output
* the captured byte stream via the serial.
*/
#include <SPI.h>
@Mebus
Mebus / joinscript.py
Last active August 29, 2015 14:03
simple example script to join lecture notes with python and pdfjoin
#!/usr/bin/python
import os
def shellquote(s):
return "'" + s.replace("'", "'\\''") + "'"
files = sorted(os.listdir("./"))
shellstring = ""
#!/bin/bash
pdftk "$1" cat 1-endE output rtnup-1.pdf
pdfjam --outfile rtnup-2.pdf --nup 2x1 --landscape rtnup-1.pdf
pdftk rtnup-2.pdf cat 1-endW output rtnupped.pdf
#!/bin/bash
#
# Get current swap usage for running processes
# Original: Erik Ljungstrom 27/05/2011
# Modifications by ariel:
# - Sort by swap usage
# - Auto run as root if not root
# - ~2x speedup by using procfs directly instead of ps
# - include full command line in output
# - make output more concise/clearer
@Mebus
Mebus / wget.py
Created March 14, 2015 10:04
wget.py
import urllib, os
# if you comment out this line, it will download to the directory from which you run the script.
os.chdir('/tmp/test')
url = 'http://www.mydomain.com/myfile.txt'
urllib.urlretrieve(url)
@Mebus
Mebus / gist:1587ce7f24e6b9e8d103
Created February 12, 2016 00:36
DN42 ASCII Art
.:::::,
:::::::`
,::::::::
:::::::::.
:::::::::::
`. ; ,;, '''''',::::::::::
;@. '@ :@@@@@` ;''''''::::::::::`
;@. :@@ @@;:#@@ `''''''''.:::::::,
;@. .@@@ + #@; ''''''''';:::::::
;@. @@@@ :@+ ,''''''''''.,,,,,`
@Mebus
Mebus / .profile
Created January 23, 2017 21:19
.profile for using the ssh agent with git on Windows
gent_running() {
[ "$SSH_AUTH_SOCK" ] && { ssh-add -l >/dev/null 2>&1 || [ $? -eq 1 ]; }
}
env=~/.ssh/agent.env
if ! agent_running && [ -s "$env" ]; then
. "$env" >/dev/null
fi
@Mebus
Mebus / kwacros.py
Last active March 18, 2017 17:16 — forked from skyl/kwacros.py
Django Template macros with args and kwargs
#
# templatetags/kwacros.py - Support for macros in Django templates
#
# Based on snippet by
# Author: Michal Ludvig <[email protected]>
# http://www.logix.cz/michal
#
# modified for args and kwargs by Skylar Saveland http://skyl.org
#