Skip to content

Instantly share code, notes, and snippets.

View nkoehring's full-sized avatar

Norman nkoehring

View GitHub Profile
@nkoehring
nkoehring / gist:1021561
Created June 12, 2011 13:40
how to format a pendrive and create a opensuse install medium with it
# For this to work you may need to install dosfstools and unetbootin if they are not already installed.
# Plug in the pen drive, close any auto-opened windows and open a shell aka console or terminal.
# Type in following commands (everything bevor #) and replace <device> with the proper device name.
sudo -s # or su
# find the usb device: its usually the last scsi-device
ls /dev/sd* # take eg /dev/sdc1
mount | grep /media # you can additionally look, which one is mounted in /media (may be saver than guessing)
umount /dev/<device> # or /media/<devicename> or some clicking inside the file browser
mkfs.vfat /dev/<device> # create the FAT file system
@nkoehring
nkoehring / gist:1026994
Created June 15, 2011 12:38
selector help for @Thelarsen
p.text a
/*definitionen*/
&:hover
/*definitionen*/
&:visited
/*definitionen*/
/*etc*/
@nkoehring
nkoehring / capitalize_each.rb
Created August 25, 2011 14:37
String::Titlelize aka String::capitalize_each_word with multiple seperators
def capitalize_each s, sep
l = s.capitalize.split('') # capitalize here for the first letter
l = l.each_with_index do |c,i|
l[i+1].upcase! if sep.include?(c)
end
new_s = l.join()
end
@nkoehring
nkoehring / syntax.coffee
Created August 27, 2011 11:51
Just a simple syntax comparision between dynamic languages. Beside of PHP as the worst variation there doesn't seem to be a language making such constructs simple to write…
data = aaData: [
["foo1", "bar1", "baz1"]
["foo2", "bar2", "baz2"]
["foo3", "bar", "baz3"]
]
@nkoehring
nkoehring / gist:1267149
Created October 6, 2011 11:06
How to get the new livingroomsong from Ólafur Arnalds and remove the garbage around in one line
wget http://erasedtapes.com/livingroomfiles/day4-UVC7726235.zip && unzip *zip && mv day4/*mp3 . && rm -r __MAC* day4 day4*.zip
@nkoehring
nkoehring / rufusmnemo.js
Created November 26, 2011 11:47 — forked from vikhyat/rufusmnemo.js
Rufus.Mnemo with support for negative numbers
var Rufus = {
Mnemo: {
/** CONSTANTS **/
V: [ 'a', 'e', 'i', 'o', 'u' ],
C: [ 'b', 'd', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'r', 's', 't', 'z' ],
SYL: [], // This is populated later on. [1]
SPECIAL: [
[ "hu", "fu" ],
@nkoehring
nkoehring / gist:1499623
Created December 20, 2011 00:37
import JSON exports from CouchDB (Padrino)
%w(account event request_template).each do |model|
json = File.open("#{model}s.backup.json", "r") {|f| f.read}
data = JSON.parse(json)
data.each {|datum| model.classify.constantize.create(datum).save}
end
Schwerwiegend: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.renderer.RendererException: Image format 'DXT1' is unsupported by the video hardware
at com.jme3.renderer.lwjgl.TextureUtil.checkFormatSupported(TextureUtil.java:91)
at com.jme3.renderer.lwjgl.TextureUtil.uploadTexture(TextureUtil.java:175)
at com.jme3.renderer.lwjgl.LwjglRenderer.updateTexImageData(LwjglRenderer.java:1879)
at com.jme3.renderer.lwjgl.LwjglRenderer.setTexture(LwjglRenderer.java:1901)
at com.jme3.material.MatParamTexture.apply(MatParamTexture.java:46)
at com.jme3.material.Material.render(Material.java:1009)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:649)
at com.jme3.post.FilterPostProcessor.renderProcessing(FilterPostProcessor.java:192)
e = Event.first
e.exhibitor_ids.each do |e_id|
emi = ExhibitorMetaInformation.new(:exhibitor_id => e_id)
e.exhibitors << emi
e.save
end
e.exhibitor_ids = nil
e.save
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(0));
return (rand()%5)+1;
}