Skip to content

Instantly share code, notes, and snippets.

@ion1
ion1 / test.c
Created Jan 29, 2010
Optimization of modified brownian noise
View test.c
// Optimization of modified brownian noise: trying to get rid of branching in
// the ‘reference’ function.
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static inline float
reference (const float a, const float b)
@ion1
ion1 / 99-shutdown-scheduled
Created Feb 1, 2010
A “shutdown/reboot scheduled” warning for update-motd
View 99-shutdown-scheduled
#!/bin/sh
set -e
if [ ! -e /var/run/shutdown.pid ]; then
exit 0
fi
my_tput() {
2>/dev/null tput -Tansi "$@" || :
}
@ion1
ion1 / gist:294841
Created Feb 4, 2010
Getting aj’s Spicy built
View gist:294841
Removing Headers/Makefile
Removing Headers/Makefile.in
Removing Headers/Spicy/Makefile
Removing Headers/Spicy/Makefile.in
Removing Makefile
Removing Makefile.in
Removing Source/.deps/
Removing Source/.libs/
Removing Source/JSONParser.lo
Removing Source/Makefile
@ion1
ion1 / compass_examples
Created Feb 25, 2010
Some Compass examples
View compass_examples
Some Compass <http://compass-style.org/> examples
┌──────────────────┐
│ NESTED SELECTORS │
└──────────────────┘
// SASS
#header
background-color: blue
View gist:318639
http://github.com/ion1/t5w.fi
% cd your-project-directory
% sudo apt-get install gitg
(not a typo)
% git clone git://github.com/ion1/t5w.fi.git
% cd t5w.fi
% gitg
% sudo apt-get install rubygems
% sudo gem install rake bundler
View gist:318731
http://weblog.rubyonrails.org/2010/2/5/rails-3-0-beta-release
”The first line is required because RubyGems currently can’t mix prerelease
and regular release gems (someone please fix that!).”
Asennetaan tuon vuoksi Rails Bundlerilla:
% export PATH="$PATH:/var/lib/gems/1.8/bin"
% sudo gem install bundler --version=0.9.9
(0.9.10 vaatii uudemman RubyGemsin kuin Debianissa/Ubuntussa on.)
@ion1
ion1 / have_a_member_matcher.rb
Created Mar 15, 2010
have_a_member matcher for Rspec 2
View have_a_member_matcher.rb
require 'rspec/matchers'
[[:have_a_member, "have a member", :any?],
[:have_every_member, "have every member", :all?]].
each do |name, desc, iterator|
Rspec::Matchers.define name do |matcher|
match do |actual|
actual.send(iterator) {|member| matcher.matches? member }
end
description do
@ion1
ion1 / ski.erl
Created Mar 23, 2010
A quick and dirty lambda calculus to combinatory logic transformer
View ski.erl
-module (ski).
% http://en.wikipedia.org/wiki/Combinatory_logic
-export ([apply/2, lambda/2, transform/1, to_binary/1, to_iolist/1]).
-record (apply, {function, input}).
-record (lambda, {name, expression}).
-define (APPLY (Function, Input), #apply{function=Function, input=Input}).
@ion1
ion1 / background-slideshow-generate
Created Mar 25, 2010
background-slideshow-generate
View background-slideshow-generate
#!/bin/sh
set -e
duration=1800
dir="$(dirname "$0")"
dir="$(readlink -f "$dir")"
output="$dir/background.xml"
output_temp="$output.new$$"
@ion1
ion1 / gist:344284
Created Mar 25, 2010
DNS records for Google Apps
View gist:344284
@ MX 10 aspmx.l.google.com.
MX 20 alt1.aspmx.l.google.com.
MX 20 alt2.aspmx.l.google.com.
MX 30 aspmx2.googlemail.com.
MX 30 aspmx3.googlemail.com.
MX 30 aspmx4.googlemail.com.
MX 30 aspmx5.googlemail.com.
TXT "v=spf1 include:aspmx.googlemail.com ~all"
;
_xmpp-server._tcp SRV 5 0 5269 xmpp-server.l.google.com.