Skip to content

Instantly share code, notes, and snippets.

@ion1
ion1 / test.c
Created January 29, 2010 20:10
Optimization of modified brownian noise
// 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 February 1, 2010 17:50
A “shutdown/reboot scheduled” warning for update-motd
#!/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 February 4, 2010 16:32
Getting aj’s Spicy built
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 February 25, 2010 11:06
Some Compass examples
Some Compass <http://compass-style.org/> examples
┌──────────────────┐
│ NESTED SELECTORS │
└──────────────────┘
// SASS
#header
background-color: blue
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
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 March 15, 2010 04:21
have_a_member matcher for Rspec 2
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 March 23, 2010 22:02
A quick and dirty lambda calculus to combinatory logic transformer
-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 March 25, 2010 23:05
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 March 25, 2010 23:56
DNS records for Google Apps
@ 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.