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
var c,i,s,p,opcodes | |
c = '10 20 add 5 sub' | |
i = 0 | |
s = new Array(100) | |
p = -1 | |
opcodes = { | |
'add': 's[p - 1] = s[p--]*1 + s[p]*1', | |
'sub': 's[p - 1] = s[p - 1]*1 - s[p--]*1;' | |
} |
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
/** | |
* Self modifying code | |
*/ | |
function genF(x) { | |
return new Function('x', 'return x + ' + x) | |
} | |
function screw(f) { | |
var src = f.toString() |
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
/** | |
* Tel seznam trie | |
*/ | |
function trie(key, value) { | |
key += '' | |
var t = {} | |
key.length > 1 ? t[key[0]] = trie(key.substring(1), value) : t[key] = {val: value} | |
return t | |
} |
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
/** | |
* Trie | |
*/ | |
function trie(s) { | |
s += '' | |
var t = {} | |
s.length > 1 ? t[s[0]] = trie(s.substring(1)) : s.length ? t[s] = false : t = false | |
return t | |
} |
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
function Tuple(car, cdr) { | |
this.car = car | |
this.cdr = cdr | |
} | |
function List(val) { | |
Tuple.call(this, val, null) | |
} | |
List.prototype = Object.create(Tuple.prototype) |
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
#!/bin/bash | |
# Sleduje online prenos zapasu a pri zmene skore odesle sms pres script sms.sh. | |
source ~/shell/colors.sh | |
skoreOld="" | |
skore="" | |
yellow "\n SMS ONLINE SPORT CHECKER \n" | |
while [ 1=1 ] | |
do | |
wget -q http://www.onlajny.com/match/index/date/2014-04-27/id/102805 | |
skore=`grep "hlavniSkore" 102805 | sed 's/item_102805_1//g; |
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
#!/bin/sh | |
DATA=~/shell/todo.csv | |
h(){ | |
echo 'h - help\np - print\nl - last\ni - insert\nd - delete\nw - write\nq - quit' | |
} | |
q(){ | |
exit | |
} | |
p(){ | |
printf '%2s %1s %-42s %-4s %-6s\n' 'id' 'p' 'polozka' 'doba' 'termin' |
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
#!/bin/sh | |
DOMAIN='www.olomouc.eu' | |
date +%T | |
echo $DOMAIN > sitemap.txt | |
while read url | |
do | |
echo "nacitam adresu $url" |
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
// partially invoked function | |
function add(x, y) { | |
if (arguments.length == 1) | |
return function(y) {return x + y} | |
return x + y | |
} | |
// pipe function for chaining function calls | |
function pipe() { |
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
/* | |
* zadani bylo neco jako vytvorit funkci ktera bude zamenovat znaky podle posunu o naky misto v abecede | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct { | |
char znak; | |
char sifra; | |
} zamena; |