Skip to content

Instantly share code, notes, and snippets.

View dezgeg's full-sized avatar

Tuomas Tynkkynen dezgeg

  • Helsinki, Finland
View GitHub Profile
@dezgeg
dezgeg / gist:1306340
Created October 22, 2011 18:37
Brainfuck-shakkilauta
Variables: first digit; second digit; multiplier; scratch1; scratch2
,------------------------------------------------ convert 1st digit from ascii
>, read second digit
---------- subtract '\n'
[ if not newline; calculate 10*digit1 plus digit2 to digit1
-------------------------------------- convert from ascii
>++++++++++ set multiplier to 10
[- loop while multiplier not zero
<<[->>>+>+<<<<] destructively copy 1st digit to scratch1 & scratch2
public class Test
{
public static String asd;
public static String bar;
public static void main(String[] args)
{
String foo = "";
for(int i = 0; i < 1000; i++)
foo += "foo";
}
@dezgeg
dezgeg / gist:2593304
Created May 4, 2012 08:29
Java, Integer ja yhtäsuuruudet
tmtynkky@melkki:~$ cat Test.java
public class Test
{
public static void main(String[] args)
{
for(int i = 120; i < 140; i++)
{
Integer j1 = i;
Integer j2 = i;
@dezgeg
dezgeg / gist:5081424
Created March 4, 2013 10:41
URxvt-konffit
URxvt.saveLines: 15000
URxvt.foreground: White
URxvt.background: Black
URxvt.visualBell: false
URxvt.scrollBar_right: true
URxvt.scrollstyle: plain
! ?? does this do anything?
URxvt.secondaryScroll: true
diff --git a/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java b/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java
index fbaec9b..b123da7 100644
--- a/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java
+++ b/src/main/java/fi/helsinki/cs/titokone/GUIBrain.java
@@ -338,6 +338,8 @@ public class GUIBrain {
* This method corresponds to the menu option File -> Run. It does
* its work by calling runInstruction().
*/
+ private long lastMillis;
+ private int lastCycles;
@dezgeg
dezgeg / gist:5481592
Created April 29, 2013 13:31
Omamatkakortti Ruby.
require 'rubygems'
require 'mechanize'
require 'nokogiri'
require 'logger'
require 'json'
baseUrl = 'https://omamatkakortti.hsl.fi'
http = Mechanize.new
http.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
# http.log = Logger.new('/dev/stderr')
import sys
testRunDelim = '======================================================================'
testsRan = 0
try:
while True:
line = sys.stdin.readline()
if testRunDelim in line:
testsRan = 0
elif line == "\n":
@dezgeg
dezgeg / CrashPassword.cpp
Created June 26, 2014 17:21
Crash Bandicoot (NTSC-U) password checksum
#include <stdint.h>
#include <stdio.h>
typedef int32_t Word; // shift instruction does srav
enum {
CIR,
SQU,
EXS,
TRI,

Please publicly post the following Gist, and name it keybase.md:

Keybase proof

I hereby claim:

  • I am dezgeg on github.
  • I am dezgeg (https://keybase.io/dezgeg) on keybase.
  • I have a public key whose fingerprint is 7D69 9DDD 1CBE 52F2 104A 0169 5F47 ECE0 2178 1149
#!/bin/bash
cd "$(dirname "$0")"
if ! [ -f csv.zip ]; then
echo "Downloading data." >&2
wget http://pilvilinna.cert.fi/opendata/autoreporter/csv.zip
fi
echo "Incident category frequencies:"
unzip -c csv.zip 2>/dev/null | grep -v '^#' | cut -d'|' -f6 | sort | uniq -c | perl -pe 's/^ *(\d+) (.*)$/$2 $1/'