Skip to content

Instantly share code, notes, and snippets.

View Mebus's full-sized avatar
😀

Mebus Mebus

😀
View GitHub Profile
@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)
#!/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
#!/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
@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 = ""
// 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 / 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);