Skip to content

Instantly share code, notes, and snippets.

@aurelijusb
aurelijusb / awesome-rc.lua
Created August 7, 2013 08:53
Awesome window manager configurations snippets. Win+Shift+[Arrows] to move with window to next tag (workspace). Fine tuned from http://awesome.naquadah.org/wiki/Move_Window_to_Workspace_Left/Right
-- clientkeys =
awful.key({ modkey, "Shift" }, "Left",
function (c)
local curidx = awful.tag.getidx()
local screen = mouse.screen
if curidx == 1 then curidx = 9 else curidx = curidx - 1 end
awful.client.movetotag(tags[client.focus.screen][curidx])
awful.tag.viewonly(tags[screen][curidx])
end),
@aurelijusb
aurelijusb / sbt-interpreter
Created August 8, 2013 08:30
Scala Build tool (http://www.scala-sbt.org/) command for testing GUI. Compiles and executes on file changes.
~run
@aurelijusb
aurelijusb / addVHost.sh
Created August 18, 2013 14:12
Small scripts to move mysql to other location and add new VirtualHost. Designed for Apache and Ubuntu.
#!/bin/sh
# Adds new virtual host to Apache and hosts file.
if [ "$#" -ne 2 ]
then
echo "Usage: addVHost.sh directory domain"
echo "Example: www/myProject myproject.local"
exit 1
fi
@aurelijusb
aurelijusb / iocron.sh
Created October 6, 2013 16:41
Small script used to compile/execute code on save: E.g. ./iocron.sh folder/ "echo '=====================' && date && echo '=====================' && php folder/test.php"
#!/bin/sh
# About:
# Execute command when file is changed.
#
# Usage:
# ./iocron.sh filt/to/watch "echo 'command'"
#
# Dependencies
# sudo apt-get install inotify-tools
@aurelijusb
aurelijusb / array-swap.php
Last active December 30, 2015 23:08
PHP array swap example.PHP saves memory when passing arrays by value and creating new ones in different order.Only symbols' table is updated.
<?php
$a = [1,2];
function f($b) {
xdebug_debug_zval('b');
return [$b[1], $b[0]];
}
xdebug_debug_zval('a');
$c = f($a);
xdebug_debug_zval('c');
@aurelijusb
aurelijusb / README.md
Last active January 3, 2016 19:29
Scala trait for debugging infinity recursions.

Usage

  • Extend your class with Debugable trait
  • (optional) write initialCommands in build.sbt
  • run sbt REPL on file chage

Extending

@aurelijusb
aurelijusb / array.php
Created March 15, 2014 16:21
State based sumation to callback based sumation example.
<?php
require 'context.php';
$odd = array_flip(array_filter(array_flip($pairs),
function($key) { return $key % 2 == 0; }
));
$even = array_diff($pairs, $odd);
$sumOdd = array_reduce($odd, Summation::$fSum);
$sumEven = array_reduce($even, ['Summation', 'rSum']);
@aurelijusb
aurelijusb / REDME.md
Created December 2, 2015 19:43
Server-Client (server-localhost) example
@aurelijusb
aurelijusb / screenRecorder.sh
Created December 8, 2015 19:59
Very simple screen recorder
#!/bin/sh
while true; do
import -window root `date +%s-%N`.jpg
sleep 1
done;
@aurelijusb
aurelijusb / README.md
Created December 8, 2015 20:12
Lazy evealuation as callback

Visuals for prezentation: Being lazy in practice