Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Upload a document of any type to Google Docs from the command line. Requires a Google Apps Premier domain and the Google Data APIs Python client (http://code.google.com/p/gdata-python-client/downloads/list).
Usage:
$ pump_to_gdocs.py -f <file name> -t <mime type>
package dropify;
import processing.core.PApplet;
import processing.core.PImage;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.io.BufferedReader;
import java.io.DataOutputStream;
@malcolmt
malcolmt / Malcolm's $PS1 prompt
Created September 17, 2010 19:21
People keep asking about my fancy bash prompt (I've been using it since the mid-90's). So, here it is.
.-(malcolm@djelibeybi 15:19:34) ~
`--> echo $PS1
\n\[\033[35m\].-(\[\033[33m\]\u@\h \[\033[36m\]\t\[\033[35m\]) \[\033[0m\]\w\n\[\033[35m\]\`-->\[\033[0m\]
I should note that in my .bashrc file, I enter the information like this:
# My fancy two-line, colored prompt
e=\\\033
export PS1="\n\[$e[35m\].-(\[$e[33m\]\u@\h \[$e[36m\]\t\[$e[35m\])\[$e[0m\]\w\n\[$e[35m\]\\\`-->\[$e[0m\] "
@swinton
swinton / percentages.js
Created August 8, 2012 20:59
Function to generate a percentage calculator.
// Function to generate a percentage calculator.
// Percentages will be rounded to nearest whole number.
// The calculator ensures the entire set of percentages adds up to 100.
var percentageCalculatorGenerator = function(numDataPoints, total) {
// Ensure cumulative total adds up to 100
var cumulativeTotal = 0;
// Return the generated function
return function(value, idx) {
@swinton
swinton / grequests_oauth_example.py
Created August 16, 2012 13:13
Example of using grequests with oauth
#!/usr/bin/env python
"""
Example of using grequests with OAuth.
See: https://github.com/kennethreitz/grequests
"""
import json
@swinton
swinton / echobot.py
Created September 24, 2012 15:21
Connect to Twitter, track a hashtag, read out the tweets
#!/usr/bin/env python
"""Connect to Twitter, track a hashtag, read out the tweets!"""
import sys
import subprocess
import multiprocessing
import track
"""
How Django generates SECRET_KEYs for new Django projects.
See:
https://github.com/django/django/blob/1.7.1/django/core/management/commands/startproject.py#L27
"""
from django.utils.crypto import get_random_string
# Create a random secret_key
@sigma
sigma / ipy_profile_gae.py
Created August 29, 2010 09:39
#published GAE #ipython configuration
import IPython.ipapi
from getpass import getpass
from netrc import netrc
from optparse import OptionParser
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.tools.appcfg import AppCfgApp, StatusUpdate
from google.appengine.tools.bulkloader import RequestManager
@brandonb927
brandonb927 / LICENSE.md
Last active October 11, 2020 09:13 — forked from valpackett/LICENSE.md
Use Markdown in Evernote with Marked.app
       DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
               Version 2, December 2004

Copyright (C) 2012 Brandon B. brandon@brandonbrown.io

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

@nodebugle
nodebugle / bbcradio.sh
Last active February 23, 2021 14:03 — forked from stengland/bbcradio.sh
Play BBC Radio with mpd or mplayer from the command line
#!/bin/bash
play() {
playlist="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_$1_mf_p"
echo $playlist
if mpc
then
echo "Using mpc"
mpc add $playlist
mpc play
else