- Install getmail (aptitude install getmail4)
- Set Up Your Imap Server (tl;dr)
- getmail
ruby date_based_archive.rb ~/Maildir/.Archive
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
# Hoptoad integration example. | |
task "deploy:before" => "isolate:dotgems" do | |
if /\.gems/ =~ `git status` | |
abort "Changed gems. Commit '.gems' and deploy again." | |
end | |
ENV["TO"] = Deploy.env | |
end |
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
import matplotlib,numpy | |
import pylab | |
# A random colormap for matplotlib | |
cmap = matplotlib.colors.ListedColormap ( numpy.random.rand ( 256,3)) | |
pylab.imshow ( Z, cmap = cmap) | |
pylab.show() |
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
# -------------------------------------------------------------------- | |
# An implementation of the "Growing Tree" algorithm. This one is | |
# notable for it's ability to become nearly identical to Prim's | |
# algorithm, or the Recursive Backtracking algorithm, depending on | |
# how the cells are removed from the list that aggregates as the | |
# algorithm runs. | |
# | |
# This script allows you to play with those settings by specifying | |
# the mode after the width and height parameters, as "random" (pull | |
# the cell from list at random), "newest" (pull the newest cell), |
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
irb(main):001:0> class Foo; def to_ary; ['<3', :hi]; end end | |
=> nil | |
irb(main):002:0> a ,= Foo.new | |
=> #<Foo:0x007fbd8a08c4e8> | |
irb(main):003:0> a | |
=> "<3" | |
irb(main):004:0> |
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
# LICENSE: public domain | |
def calculate_initial_compass_bearing(pointA, pointB): | |
""" | |
Calculates the bearing between two points. | |
The formulae used is the following: | |
θ = atan2(sin(Δlong).cos(lat2), | |
cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong)) |
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
<!-- This code is public domain, share and enjoy. --> | |
<html> | |
<style type="text/css" media="screen"> | |
#table { | |
position: absolute; | |
top: 30px; | |
bottom: 0; | |
left: 10px; | |
right: 10px; | |
} |
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 'fiddle' | |
require 'minitest/autorun' | |
class RubyVM | |
class InstructionSequence | |
address = Fiddle::Handle::DEFAULT['rb_iseq_load'] | |
func = Fiddle::Function.new(address, [Fiddle::TYPE_VOIDP] * 3, Fiddle::TYPE_VOIDP) | |
define_singleton_method(:load) do |data, parent = nil, opt = nil| | |
func.call(Fiddle.dlwrap(data), parent, opt).to_value |
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
$stack, $draws = [], {} | |
def method_missing *args | |
return if args[0][/^to_/] | |
$stack << args.map { |a| a or $stack.pop } | |
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
end | |
class Array | |
def +@ |
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
""" | |
Safely deal with unicode(utf-8) in csv files | |
removing nasty BOM surprises | |
""" | |
import csv | |
import codecs | |
OlderNewer