Skip to content

Instantly share code, notes, and snippets.

import os
import requests
from clint.textui import progress
s = requests.session()
def iter_photos():
#!/bin/bash
SLEEP=`echo "$1*3600" | bc`
echo "Alarm triggered in $1 hours"
sleep $SLEEP > /dev/null
echo "Starting playing"
mpc volume 50 > /dev/null
mpc play > /dev/null
mpcfade.sh 50 65 0
mpcfade.sh 65 75 1
echo "Turning on TV and switching input to me"
@caspian311
caspian311 / client.py
Created January 30, 2013 19:36
Simple client-service dbus example in python.
#!/usr/bin/env python
import dbus
class Client():
def __init__(self):
bus = dbus.SessionBus()
service = bus.get_object('com.example.service', "/com/example/service")
self._message = service.get_dbus_method('get_message', 'com.example.service.Message')
self._quit = service.get_dbus_method('quit', 'com.example.service.Quit')
@EHLOVader
EHLOVader / RFCEmail.md
Last active April 13, 2023 02:31
Like Grammar Nazis I have run into misguided attempts to validate or use emails in applications enough that I put together this standard RFC email speech that i give to websites which fail on gmail plus notation email formats. Normally nothing changes, but maybe one day they will forward it to the right people and they will fix it.

I would like to note that your website restricts and disallows absolutely valid email addresses, in particular mine. I respectfully request that you update your sites email checks to allow valid email addresses which may not be particularly regular, but are absolutely valid.

I have included the requirements for email addresses along with their standards reference in RFC definitions.

  1. An e-mail address consists of local part and domain separated by an at sign (@) character (RFC 2822 3.4.1).

  2. The local part may consist of alphabetic and numeric characters, and the following characters: !, #, $, %, &, ', *, +, -, /, =, ?, ^, _, `, {, |, } and ~, possibly with dot separators (.), inside, but not at the start, end or next to another dot separator (RFC2822 3.2.4).

  3. The local part may consist of a quoted string—that is, anything within quotes ("), including spaces (RFC 2822 3.2.5).

@235
235 / disable_csrf.py
Created October 4, 2012 18:24
Django: Disables CSRF for the whole project to simplify prototyping, unsecure in production
""" Disables CSRF for the whole project to simplify prototyping, unsecure in production """
class DisableCSRF(object):
#def process_view(self, request, callback, callback_args, callback_kwargs):
def process_request(self, request):
setattr(request, '_dont_enforce_csrf_checks', True)
### === Add to settings.py:
#==============================================================================
@ser1zw
ser1zw / PLSQL_WWW_GET_SAMPLE.sql
Created September 20, 2012 19:03
PL/SQL sample for HTTP access
/*
PL/SQL sample for HTTP access (Oracle 11g R2)
1. Execute /u01/app/oracle/product/11.2.0/xe/rdbms/admin/utlhttp.sql to use UTL_HTTP package
Run the following command in shell in the DB server
$ cd /u01/app/oracle/product/11.2.0/xe/rdbms/admin/
$ sqlplus SYS/passwd@localhost:1521/XE AS SYSDBA @utlhttp.sql
2. Grant the connect and resolve privileges for all hosts to the user 'SCOTT'
Run the following commands in SQL*Plus
@swanson
swanson / unblur_quora.user.js
Created July 30, 2012 17:11
Chrome user script to unblur Quora answers without signing up
// ==UserScript==
// @match http://*.quora.com/*
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
@exhuma
exhuma / gist:2136677
Created March 20, 2012 15:06
Bash completion for fabric
#
# Bash completion for fabric
#
function _fab_complete() {
local cur
if [[ -f "fabfile.py" || -d "fabfile" ]]; then
@rorydriscoll
rorydriscoll / lua.sublime-build
Created February 17, 2012 18:03
Sublime Text build system for Lua
{
"cmd": ["lua", "$file"],
"file_regex": "^lua: (...*?):([0-9]*):?([0-9]*)",
"selector": "source.lua"
}

A good commit message looks like this:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about