Skip to content

Instantly share code, notes, and snippets.

View cybear's full-sized avatar

Björn Söderqvist cybear

  • Greenfield AB
  • Malmo, Sweden
View GitHub Profile
#!/usr/bin/env ruby
require 'ftools'
require 'fileutils'
require 'rubygems'
require 'RMagick'
include Magick
require 'open3'
def merge( files = [] )
@jacobandresen
jacobandresen / breathalyzer
Created December 31, 2010 10:02
learning ruby
def readData()
data=[]
f = File.open("twl06.txt", "r")
f.each_line do |line|
data << line
end
return data
end
def levenshtein(s,t)
@ulf
ulf / kittenclock.html
Created March 1, 2011 13:09
Clock based on Placekittens
<!-- Thanks to cybear https://gist.github.com/846273 for the clock and to placekittens.com for the images -->
<style>
div#clock{position:absolute;text-align:center;height:8em;top:40%;left:20%;margin:-4em 0 0 -16em}
head,title{display:block}
</style>
<script>
var bars = {
// vertical
0 : [0,0,0,1],
@danpaluska
danpaluska / iirMovie.sh
Created August 3, 2011 16:23
perform an IIR blur filter on a stack of frames from a movie using imagemagick and ffmpeg
#!/bin/bash
# ffmpeg -i movie.mov -r 1 fooframes/frames%05d.jpg
# extract 1 frame for every second of the movie...
mkdir IIRframes;
let "frames=4243/2"
echo $frames
cp WSPC0001.JPG IIRframes/new.jpg
@touv
touv / startup-app.sh
Created November 4, 2011 13:16
Startup script for Express / Node.js application with the forever module
#!/bin/sh
##3.5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80
##
## Debian / Linux / Ubuntu / LSB
## Startup script for Express / Node.js application with the forever module
##
##
## A modification of "init.d.lsb.ex" by Nicolas Thouvenin
##
##
@nimbupani
nimbupani / index.html
Created December 2, 2011 05:00
Showing latest post on home page with Jekyll
---
layout: default
---
<div class="blog-index">
{% assign post = site.posts.first %}
{% assign content = post.content %}
{% include post_detail.html %}
</div>
document.body.addEventListener('error', function(event) {
if ( event.target.nodeName.toLowerCase() == 'img' ) {
// an image on the page failed to load
}
}, true);
@Munter
Munter / optimizeimages.sh
Created May 2, 2012 12:44
Shell script to recursively optimize all image in the current directory. WARNING: THIS OVERWRITES YOUR ORIGINALS AND REMOVES METADATA!
#!/bin/sh
set -o errexit
PNGS=`find . -iname "*.png"`
JPGS=`find . -iname "*.jpg"`
TMP1="_TMP1.PNG"
TMP2="_TMP2.PNG"
echo "Optimizing PNG"
for PNG in ${PNGS}

Forget AMD and that's straight from the source. Sorry for the long build-up on the history, but if I'm to convince you to forget this non-technology, I think it's best you know where it came from. For those in a hurry, the executive summary is in the subject line. ;)

In Spring of 2009, I rewrote the Dojo loader during a requested renovation of that project. The primary pattern used to make it more practical was:

dojo.provide('foo', ['bar1', 'bar2'], function() {

[module code]

});
@simX
simX / hidpi.txt
Created July 28, 2012 04:58
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.