Skip to content

Instantly share code, notes, and snippets.

View alex-quiterio's full-sized avatar
🌀
using my coding skills to fight for the climate

aIex quiterio alex-quiterio

🌀
using my coding skills to fight for the climate
View GitHub Profile
# A password hashing function insipred by Lamport OTP (a.k.a. hash chains)
# Memory factor: length of the Lamport OTP sequence
# Compute factor: number of independent Lamport OTP sequences to compute
# Hash: a keyed hash function
#
# Finally, all of the Lamport OTP chains calculated are concatenated and hashed
# to produce the resulting digest
#
# Just for fun, this has been implemented with threads to demonstrate how easily
# it can be parallelized, much like CTR mode (NOTE: you will need JRuby or Rubinius
source :rubygems
gem 'rails', '3.0.4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'ar-octopus', :git => 'git://github.com/tchandy/octopus.git', :require => "octopus"
var self = window;
(function(self) {
var canvas, context, particles = [], explode = true, FPS = 60;
/*
* Init.
*/
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--
According with the number used on the property
ServersNumber the bootstrapper will fetch this XML
and look for servers to initialize
-->
<add key="ServersNumber" value="1" />

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

--type-add=css=.sass,.less,.scss
--type-add=ruby=.rake,.rsel,.builder,.thor
--type-add=html=.haml,.html.erb,.html.haml
--type-add=js=.js.erb,.coffee
--type-set=cucumber=.feature
--type-set=c=.c,.cpp,.ino,.pde,.h
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=doc
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
class ApplicationController < ActionController::Base
caches_action :render_html,
:cache_path => Proc.new { "#{LastChange::last_update}/pages/#{params[:cms_path]}" },
:if => Proc.new { controller_name == "cms_content" }
end
public class Test {
@Assertion("foo>0")
int foo=1;
@Assertion("bar%2==0")
long bar;
@Assertion("baz>foo")
int baz;
@alex-quiterio
alex-quiterio / dabblet.css
Created March 1, 2013 12:05
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 12%;
border-ra