Skip to content

Instantly share code, notes, and snippets.

View themartorana's full-sized avatar

Dave Martorana themartorana

View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@diox
diox / clear_johnny_cache.py
Created July 5, 2011 16:30
Django management command to clear johnny-cache cache :-)
import sys
import logging
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = ("Invalidates portions of the queryset cache based on the app names"
" or models provided as arguments to the command. If no arguments "
"are provided, nothing is done. To clear the entire queryset "
@milancermak
milancermak / gist:3451509
Created August 24, 2012 14:47
Example of validating a recurring payment from Google Play using the Web server application OAuth 2.0 flow
import datetime
import httplib2
# to see in detail what's going on, uncomment
# httplib2.debuglevel = 4
from apiclient.discovery import build
from oauth2client.client import OAuth2Credentials, OAuth2WebServerFlow
if __name__ == "__main__":
---- APP VERSION -----
----- 1.2 (76) -----
CONFIG FORMAT
{
// how many seconds between polling for opponent move, default 3.5
@themartorana
themartorana / mailplane.css
Created October 16, 2012 15:24
MailPlane Style Customization CSS
/* gmail-refreshest: a custom gmail css by @roycifer */
/* some button styles borrowed from twitter bootstrap */
/* @match mail.google.com */
body, td, input, textarea, select {font-family:"Helvetica Neue",helvetica,arial,sans-serif;}
.w-asV > .nH:last-child {display: none;}
.w-asV > .nH > .no , #gbx1, #gbx2{background-image: -webkit-linear-gradient(top,white,#F7F7F7);}
.w-as1.nr{height:27px;border-radius:3px;}
.gbeti#gb .gbqldr, .gbet#gbqlw .gbqldr, .gbesi#gb .gbqldr, .gbes#gbqlw .gbqldr{max-height:35px;margin-top:3px;}
.gbqfqw{border-radius:3px;}
@benmmurphy
benmmurphy / riak_graphite_stats.sh
Last active October 12, 2015 17:57
riak -> graphite stats cron job
#!/bin/bash
# * * * * * root /path/to/riak_graphite_stats.sh
set -e
SOURCE=$(hostname)
GRAPHITE_PORT=2003
GRAPHITE_SERVER="server"
PREFIX="riak_stats"
STATUS=$(/usr/sbin/riak-admin status)
@carbocation
carbocation / gist:5278173
Last active February 14, 2016 18:40
On OS X, use fswatch to automatically recompile your golang project whenever you change a file in the directory.
#!/bin/bash
# This script keeps watch on the current project and compiles it continuously as you change files.
# If there are multiple projects with the same final directory name (e.g., /proj/rad and /lib/monster/rad),
# this will kill any other similarly-named running projects' binaries, potentially leading to havoc.
# To run, install fswatch, drop this file into your project directory, make it executable, and run:
# /usr/local/bin/fswatch ./ ./continuous-compile.sh
echo "Re-compiling"
@chrisdarroch
chrisdarroch / idea
Created October 17, 2013 03:40
Open a project in IntelliJ IDEA from your command line!
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
@derpston
derpston / riakcollector.py
Last active December 28, 2015 01:29
Plugin for diamond, collects stats from riak over http locally and submits to Graphite.
# Plugin for the diamond to collect stats from Riak over HTTP.
#
# Copyright (c) 2013, Metricfire Ltd (Hosted Graphite)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@jmoiron
jmoiron / 01-curl.go
Last active December 16, 2022 10:34
io.Reader & io.Writer fun
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func init() {