Skip to content

Instantly share code, notes, and snippets.

View lest's full-sized avatar

Sergey Nartimov lest

View GitHub Profile
require 'benchmark'
def method1(&block)
true if block
end
def method2(&block)
true if block_given?
end
@lest
lest / lolcat.hs
Created September 5, 2011 20:45
simple lolcat powered by haskell
import Data.Word
freq = 0.3
spread = 8.0
unbase :: Integral int => int -> Word8 -> Word8 -> Word8 -> int
unbase base r g b = (fi r*base+fi g)*base+fi b
where fi = fromIntegral
-- | Approximate a 24-bit Rgb colour with a colour in the xterm256 6x6x6 colour cube, returning its index.
@lest
lest / gist:710117
Created November 22, 2010 15:32
Place this to your Capfile
server 'server.host.or.ip.address', :app
set :user, 'user'
set :deploy_to, '/path/to/deploy'
set :repository, 'git repository address'
set :branch, 'origin/master'
namespace :deploy do
desc 'Deploy'
task :default do
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
class Asset < ActiveRecord::Base
# === List of columns ===
# id : integer
# data_file_name : string
# data_content_type : string
# data_file_size : integer
# assetable_id : integer
# assetable_type : string
# type : string
%% Create N processes in a ring.
%% Send a message round the ring M times so that a total of N * M messages get sent.
-module(ring).
-export([start/0, start/2]).
start() ->
start(10, 10).
start(N, M) ->
@lest
lest / .zshrc
Created March 1, 2010 17:25
.zshrc
[ -f $HOME/.profile ] && . $HOME/.profile
HISTSIZE=2000
SAVEHIST=$HISTSIZE
HISTFILE=$HOME/.zsh_history
setopt append_history
setopt inc_append_history
setopt extended_history
setopt hist_find_no_dups
setopt hist_ignore_all_dups
We couldn’t find that file to show.