This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'eventmachine' | |
require 'em-http-request' | |
require 'json' | |
class TimeFetcher | |
include EM::Deferrable | |
def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gmail' | |
gmail = Gmail.new(GMAIL_USERNAME, GMAIL_PASSWORD) | |
r = Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/) | |
addresses = [] | |
gmail.inbox.emails(:after => Date.parse("2012-01-04"), :subject => "Mail delivery failed: returning message to sender").each do |m| | |
m.body.to_s.scan(r).uniq.each do |a| | |
addresses << a | |
end | |
end | |
puts addresses.uniq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ajax_detect(request): | |
""" | |
Templace context processor to detect Ajax requests | |
The function sets the template variable root_template, which | |
indicates which parent-template should be used | |
""" | |
r = "index.html" | |
if request.is_ajax(): | |
r = "ajax.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Thanks to cybear https://gist.github.com/846273 for the clock and to placekittens.com for the images --> | |
<style> | |
div#clock{position:absolute;text-align:center;height:8em;top:40%;left:20%;margin:-4em 0 0 -16em} | |
head,title{display:block} | |
</style> | |
<script> | |
var bars = { | |
// vertical | |
0 : [0,0,0,1], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun dropbox-auto-revert () | |
(when (string-match "Dropbox" buffer-file-name) | |
(auto-revert-mode 1))) | |
(add-hook 'find-file-hook 'dropbox-auto-revert) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
[...] | |
# uWSGI serving Django. | |
upstream django { | |
ip_hash; | |
server unix:sock/uwsgi.sock; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun dropbox-auto-revert () | |
(when (string-match "Dropbox" buffer-file-name) | |
(auto-revert-mode 1))) | |
(add-hook 'find-file-hook 'dropbox-auto-revert) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(global-set-key (kbd "<f2>") 'gist-region) | |