This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.c | |
// kun | |
// | |
// Created by Martin Knoll on 17.10.12. | |
// Copyright (c) 2012 Martin Knoll. All rights reserved. | |
// | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
public class Median { | |
public static int median(int a, int b, int c) { | |
if (a < b) { | |
if (b < c) | |
return b; | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
class Integer | |
def to_b | |
Bin.new 0 == self ? [] : [self % 2] + (self / 2).to_b | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Graphics; | |
public class HelloWorld extends javax.swing.JApplet { | |
public void paint(Graphics g) { | |
for (int i = 0; i < 5; i++) { | |
g.drawString("Hello World", 5, 25 + (25 * i)); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def keygen( mac ): | |
bytes = [int(x, 16) for x in mac.split(':')] | |
c1 = (bytes[-2] << 8) + bytes[-1] | |
(s6, s7, s8, s9, s10) = [int(x) for x in '%05d' % (c1)] | |
(m7, m8, m9, m10, m11, m12) = [int(x, 16) for x in mac.replace(':', '')[6:]] | |
k1 = (s7 + s8 + m11 + m12) & (0x0F) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
while line = gets | |
if json = line.match(/\{.*\}/) | |
tweet = JSON.parse(json[0], :symbolize_names => true) | |
puts "@#{tweet[:user][:screen_name]}: #{tweet[:text]}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PDFont font = PDTrueTypeFont.loadTTF(document, "putr8a.ttf"); // example font (Utopia) | |
List<Float> widths = font.getWidths(); | |
for (int i = 1; i <= 22; i++) | |
widths.add(250f); // add 22 floats to cover all 255 ascii chars | |
widths.set(246, widths.get(111)); // copy width of o to ö | |
widths.set(252, widths.get(117)); // u to ü | |
font.setWidths(widths); |
NewerOlder