Skip to content

Instantly share code, notes, and snippets.

@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@slacy
slacy / models.py
Created September 4, 2012 21:56
Django Model mixin for pushing signal handling back into instance methods.
class SignalModel(models.Model):
"""A Model mixin class that lets you put your signal handler methods back into your Model class."""
@classmethod
def _sig_pre_delete(cls, instance, *args, **kwargs):
"""dispatch the pre_delete method to a regular instance method. """
return instance.sig_pre_delete(*args, **kwargs)
@classmethod
def _sig_post_delete(cls, instance, *args, **kwargs):
@embr
embr / gist:4707996
Created February 4, 2013 17:03
RescueTime Python API Example
# coding: utf-8
import pprint
import pandas as pd
from rescuetime.api.service import Service
from rescuetime.api.access import AnalyticApiKey
s = Service.Service()
k = AnalyticApiKey.AnalyticApiKey(open('rt_key').read(), s)
p = {}
@rboyd
rboyd / filter_long_emails.js
Last active July 1, 2023 05:37
google apps script to archive and autoreply to long emails.
/* paste into http://script.google.com
run periodically (e.g. every 5 minutes) with a timer by selecting 'Resources' > 'current project's triggers...'
*/
function filterLongEmails() {
var num_messages = 1; // will be applied to the last n messages. Google allows up to 500
var word_limit = 50;
var subj = "Shorter emails will get read.";
var body = "Dear friends, I value my time and yours but I appreciate it if you can keep your emails under " + word_limit + " words. Please edit and resend.";
@0sn
0sn / build_rt.py
Created April 15, 2013 16:59
A python script to turn rescuetime data into something that Panic's StatusBoard app understands
#/usr/local/bin/python
"""Build Rescuetime Graph Data for StatusBoard.app
This script pulls data from a rescuetime account and flattens it into a format
that is easily read by StatusBoard. Okay. Run it with cron or launchd, whatever.
*nick wolfe
http://nameremoved.com/
"""
@tebeka
tebeka / gist:5426211
Created April 20, 2013 14:43
Serving dynamic images with Pandas and matplotlib (using flask)
#!/usr/bin/env python2
'''Serving dynamic images with Pandas and matplotlib (using flask).'''
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from cStringIO import StringIO
@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active April 19, 2024 01:50
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@staltz
staltz / introrx.md
Last active May 7, 2024 09:38
The introduction to Reactive Programming you've been missing
@gene1wood
gene1wood / batch-delete-gmail-emails.js
Last active May 6, 2024 16:55
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
/*
This script, when used with Google Apps Scripts, will delete 400 emails and
can be triggered to run every few minutes without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Google returns a maximum of 500 email threads in a single API call.
This script fetches 400 threads in case 500 threads is causing timeouts
Configure the search query in the code below to match the type of emails
you want to delete