Skip to content

Instantly share code, notes, and snippets.

View deepak's full-sized avatar

Deepak Kannan deepak

View GitHub Profile
@norman
norman / character_reference.rb
Last active September 9, 2021 20:48
HTML entities? We don't need no stinkin' HTML entities.
# coding: utf-8
#
# Encode any codepoint outside the ASCII printable range to an HTML character
# reference (https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_reference_overview).
def encode(string)
string.each_codepoint.inject("") do |buffer, cp|
cp = "&#x#{cp.to_s(16)};" unless cp >= 0x20 && cp <= 0x7E
buffer << cp
end
end
@fogus
fogus / fp.dot
Created May 2, 2012 13:34
early influence graph of fp languages -- this is not meant to be a complete time line. I'm mostly concerned with the root and inner nodes.
digraph G {
ranksep=1.0;
ratio=0.6;
APL [color=Blue, shape=box];
Simula [color=Blue, shape=box];
LISP [color=Blue, shape=box];
ALGOL [color=Blue, shape=box];
Planner [color=Blue, shape=box];
ACTOR [shape=hexagon];
@NZKoz
NZKoz / aa_instructions.md
Created May 2, 2012 03:07
Back Up All Your Gmail
  • Install getmail (aptitude install getmail4)
  • Set Up Your Imap Server (tl;dr)
  • getmail
  • ruby date_based_archive.rb ~/Maildir/.Archive
@technoweenie
technoweenie / gist:2568117
Created May 1, 2012 14:04
Python Master/Worker forking with ZeroMQ instead of unix signals.
# Don't use this.
import zmq
import os
class Worker:
def __init__(self):
print "parent: %d, pid: %d" % (os.getppid(), os.getpid())
self.pid = os.getppid()
self.context = zmq.Context()
self.sub = self.context.socket(zmq.SUB)
@mackuba
mackuba / install.sh
Created April 26, 2012 15:46
Link all dotfiles from Dropbox
#!/bin/bash
for filename in `ls /Users/psionides/Dropbox/dotfiles`; do
name=`basename $filename .txt`
echo "Linking /Users/psionides/Dropbox/dotfiles/$filename to /Users/psionides/.$name..."
rm -f /Users/psionides/.$name
ln -s /Users/psionides/Dropbox/dotfiles/$filename /Users/psionides/.$name
done
echo "Done."

How would you like to replace me as The Guardian's Digital Operations Manager?

This is an exciting role where you'll be challenged in many different ways. Here is the mission should you choose to accept it:

  • Do whatever it takes to keep serving >400,000,000 pages a month
  • Perform capacity planning - our traffic grew over 20% over last year
  • Manage incidents - we're optimising on MTTR not MTBF
  • Help lead us down the road of Continuous Delivery - We're not quite Etsy, but we did 37 releases last month and are getting faster

If you want to know more, please view the job spec (coming soon on Guardian Jobs) and contact me at [email protected]

@brixen
brixen / gist:2426133
Created April 20, 2012 05:00
Tried to run RubySpec with MRuby
sasha:rubinius brian$ bin/mspec -t /source/mruby/bin/mruby
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
NODE_SCOPE:
local variables:
NODE_BEGIN:
NODE_CALL:
NODE_GVAR $:
method='unshift' (141)
args:
NODE_CALL:
@nex3
nex3 / gist:2354053
Created April 10, 2012 19:57
Haml call for maintainer

It's become increasingly apparent that between my full-time job and my work on Sass, I don't have the cycles any more to properly maintain Haml. I'd like to pass on the mantle to someone else, but I don't want to do it blindly.

If you're interested in becoming the maintainer of Haml, please demonstrate this by creating a fork of the repo and starting the maintenance process of addressing the issues and code-reviewing and merging pull requests into your fork. What I'm looking for is evidence that you'll be more diligent than I currently can, as well as the ability to both write good code and get good code from other contributors.

In a week or so, if anyone's taken up this challenge and done well, I'll hand them the reins.

  • Nathan Weizenbaum, Haml maintainer
@ryandotsmith
ryandotsmith / instruments.rb
Created April 6, 2012 07:09
Sequel & Sinatra Instrumentation
module Instruments
def self.set_logger(l, m)
@logger = l
@method = m
end
def self.logger
@logger
end
@judofyr
judofyr / dcpu-assembler.rb
Created April 4, 2012 15:32
Assembler for DCPU-16
class Register < Struct.new(:name)
BASIC = %w[A B C X Y Z I J].map(&:to_sym)
SPECIAL = %w[POP PEEK PUSH SP PC O].map(&:to_sym)
ALL = BASIC + SPECIAL
attr_accessor :plus
def value
case name
when *BASIC