Skip to content

Instantly share code, notes, and snippets.

@zokier
zokier / kb_layout_stats.py
Created September 9, 2011 08:08
Stats about kb layouts
# this script calculates the use of modifier keys in different kb layouts
# kotoistus is Finnish keyboard layout (and for this purpose equivalent of Swedish layout)
# fi-intl is my custom layout, essentially US layout mixed with ö and ä letters
# us is basic US layout.
symbol_counts = {
#'a': 443776445,
#' ': 74199965, # ignore spaces for now
'_': 22890057,
',': 10895692,
@zokier
zokier / gist:1951412
Created March 1, 2012 17:00
Suomalaiset nimipäivät
{
"2013-01-01": [
],
"2013-01-02": [
"Aapeli"
],
"2013-01-03": [
"Elmeri",
"Elmo",
"Elmer"
@zokier
zokier / hello.rc
Created April 19, 2012 14:34
rustc --test fails
use std;
#[link(
name="rust_hello",
vers="0.1",
author = "zokier",
url="http://github.com/zokier/rust_hello",
uuid="6240d465-7dba-4aa8-9053-027a1b12ecc4"
)];
import pygame, time, random, sys, copy, os
from pygame.locals import *
t2 = 0
nor = 0
pc = [[[1, 1], [1, 1]], [[1, 0], [1, 0], [1, 1]], [[0, 1], [0, 1], [1, 1]], [[1], [1], [1], [1]], [[0, 1, 1], [1, 1, 0]], [[1, 1, 0], [0, 1, 1]], [[1, 1, 1], [0, 1, 0]]]
cols = [(0, 0, 0), (100, 100, 100), (10, 100, 225), (0, 150, 220), (0, 220, 150), (60, 200, 10), (180, 210, 5), (210, 180, 10), (100, 200, 170)]
pygame.init()
pygame.display.set_mode((320, 240))
sk = pygame.display.get_surface()
f = [[1] + [0 for x in range(8)] + [1] for x in range(19)] + [[1 for x in range(10)]]
@zokier
zokier / AES_over_IRC.rb
Created June 15, 2012 14:13 — forked from b1nary/AES_over_IRC.rb
AES and some more encryptions over IRC
#!/usr/bin/ruby
require 'socket'
require "base64"
require "open3"
server = "localhost"
port = "6667"
nick = "Nickname#{rand(5000)}"
channel = "#channel"
@zokier
zokier / gist:2980473
Created June 23, 2012 23:00
literal overflow
#include <stdio.h>
int main(int, char**)
{
if (4294967296 != 4294967296LL)
puts("Literal overflows");
else
puts("Literal does not overflow");
}
void (*yesno_cb)(bool);
void yn_tavern_room(bool b)
{
if (b)
set_player_location(&loc_room_offline);
else
set_player_location(&loc_tavern_bartender);
}
trait_nameresolution.rs:16:21: 16:29 error: unresolved name `Bar::foo`.
trait_nameresolution.rs:16 println!("{:?}", Bar::foo()); // does not work
^~~~~~~~
note: in expansion of format_args!
<std-macros>:222:8: 222:50 note: expansion site
<std-macros>:221:4: 223:6 note: in expansion of format!
<std-macros>:239:45: 239:63 note: expansion site
<std-macros>:238:4: 240:5 note: in expansion of println!
trait_nameresolution.rs:16:4: 16:33 note: expansion site
error: aborting due to previous error
trait Foo {}
struct Bar;
impl Foo for Bar {}
fn main() {
let a: @Foo = @Bar as @Foo;
let b = a as @Bar;
}
test.rs:20:12: 20:18 error: type `&~A:Send` does not implement any method in scope named `a`
test.rs:20 a.a();
^~~~~~
error: aborting due to previous error
task '<unnamed>' failed at 'explicit failure', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:98
task '<unnamed>' failed at 'explicit failure', /build/rust-git/src/rust/src/librustc/rustc.rs:391