Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace SDR
{
public class Deque<E> : IEnumerable<E>
{
readonly int size;

Keybase proof

I hereby claim:

  • I am tyrion on github.
  • I am tyrion (https://keybase.io/tyrion) on keybase.
  • I have a public key whose fingerprint is 21CE 5B94 9D79 BC2D 25D4 8091 87EB 178A 3C06 A67F

To claim this, I am signing this object:

@tyrion
tyrion / perceptron.py
Created October 30, 2014 16:36
Perceptron
from collections import namedtuple
Input = namedtuple('Input', ['index', 'value'])
def identity(x):
return x
def step(x):
return 1 if x >= 0 else -1
@tyrion
tyrion / logparser.py
Created November 4, 2014 18:15
Parse irc logs with multiple encodings
def decode(line, encodings):
for encoding in encodings:
try:
return line.decode(encoding)
except UnicodeDecodeError:
pass
return line.decode('utf-8', 'ignore')
if __name__ == '__main__':
#!/usr/bin/env python3
"""
a a
end <---(in)--->[1]<--->[2]--> end
"""
EOF = ''
# aa*
language = [
{EOF: True, 'a': 1},
@tyrion
tyrion / fuckpyjails.py
Last active August 29, 2015 14:10
fuckpyjails
#!/usr/bin/env python
import sys
import socket
import resource
resource.setrlimit(resource.RLIMIT_NPROC, (0, 0))
def get_key():
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect("/tmp/keyserver")
@tyrion
tyrion / madness.xq
Created January 31, 2015 17:40
Madness of XQuery
declare function local:maxconsecutive($partite as element()*, $squadra as xs:string, $i as xs:integer, $max as xs:integer, $tot as xs:integer) as xs:integer {
(if ($i = count($partite)+1) then ( local:max($max, $tot))
else (
if (local:vinta($partite[$i], $squadra))
then (local:maxconsecutive($partite, $squadra, $i+1, $max+1, $tot))
else (local:maxconsecutive($partite, $squadra, $i+1, 0, local:max($max, $tot)))
))
};
declare function local:max($a as xs:integer, $b as xs:integer) as xs:integer {

IRC

Disadvantages of IRC

  • It is only real-time. No support for offline messages or history of channels.

Current problems with our IRC server setup

@tyrion
tyrion / bello.c
Created March 16, 2015 23:01
shambles MIPS
// dati smerdati input = smerdo
void sub4(int i, int smerdo) {
int *deadboob = 0xaddress;
bool v0 = 0;
i *= 4;
int t0 = deadboob[i];
int t2;
@tyrion
tyrion / smash.c
Last active November 2, 2015 21:51
#include <stdio.h>
void function(int a, int b, int c) {
char buffer1[8];
buffer1[12] += 7;
}
void main() {
int x = 0;