Skip to content

Instantly share code, notes, and snippets.

View orian's full-sized avatar

Paweł Szczur orian

View GitHub Profile
@orian
orian / dart-bash.sh
Last active October 6, 2015 16:18
Quick and dirty script to automagically download and unpack Dart editor.
# just add copy&paste to your .bashrc
# require wget, unzip
DART_PKG_NAME="darteditor-linux-64.zip"
#If variable is not defined, set variable.
check-env-var() {
X=$1
if [ -z "${!X}" ]; then
export $X=$2
echo "export $X=${!X}"
@orian
orian / robot.js
Created December 4, 2012 01:08
ZawiszaCzarny
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
this.lastHitAngle = 0;
this.radius = 20;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
@orian
orian / robot.js
Created December 4, 2012 01:22 — forked from robertomoulin/robot.js
Chewbaccax
var Robot = function(robot) {
robot.clone();
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(40);
robot.rotateCannon(360);};
Robot.prototype.onScannedRobot = function(ev) {
@orian
orian / robot.js
Created December 4, 2012 02:18 — forked from randompast/robot.js
QR-bot-002
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.turn(1);
robot.ahead(2);
@orian
orian / robot.js
Created December 4, 2012 02:30
Dzdzowniczka
var Robot = function(robot) {
};
Robot.prototype.lastHitAngle = -1;
Robot.prototype.radius = 20;
Robot.prototype.hit = 0;
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
this.hit = 0;
@orian
orian / robot.js
Created December 4, 2012 03:16 — forked from guilhermebruzzi/robot.js
Merry Go round
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot){
//robot.clone();
this.robotOptions = {
clone: {
canStartFight: false,
goBackOnCollision: false
@orian
orian / loop_test_gen.py
Created June 27, 2013 11:42
simple script to generate 31 possible loops in Dart (http://dartlang.org)
#!/usr/bin/python
from string import Template
import itertools
def GenerateOne(name, initializer, test, update, use_break, use_continue):
if not test and not use_break:
return
tmpl = Template("""
$name() {
@orian
orian / brnl_pbb_estimate.py
Created August 22, 2013 08:28
Let's say that you have an event which happen at each second with probability p, each second is independent on previous and next one. Instead of tossing a coin every second, one can try to toss a coin once and estimate when a next event is going to happen, and then call the function again at a moment of event to get next event time and so on.
#!/usr/bin/python
import random
class BernoulliPbb(object):
def __init__(self, p):
self.p = p
def Estimate(self):
r = random.random()
@orian
orian / gist:7242125
Created October 30, 2013 23:33
gcc -Wl,--verbose,-v -O3 xor_train.c -o xor_train -lfann -lm
gcc -Wl,--verbose,-v -O3 xor_train.c -o xor_train -lfann -lm
collect2 version 4.8.1
/usr/bin/ld --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o xor_train /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. --verbose -v /tmp/ccVoFJmM.o -lfann -lm -l
@orian
orian / gist:7858208
Last active December 30, 2015 16:59
Adding "swap workspace" to Xmonad

1. To imports add: import XMonad.Actions.SwapWorkspaces

2. Somewhere in file, where you have keyboard mapping add:

    -- Swap Workspaces
    , ((modm .|. controlMask,     xK_Right),  swapTo Next)
    , ((modm .|. controlMask,     xK_Left),   swapTo Prev)

3. Reload xmonad, now you can swap workspaces using combination Mod+Ctrl+Left and Mod+Ctrl+Right