Skip to content

Instantly share code, notes, and snippets.

@aurelijusb
aurelijusb / run.sh
Created July 19, 2016 19:03
Example of my-nginx/run.sh. For presentation: Docker on AWS
#!/bin/sh
echo -e "`date +'%Y-%m-%d %T.%N%z'` Starting Nginx..."
CONFIG_SRC=/custom/config/site.conf
CONFIG_DEST=/etc/nginx/conf.d/site.conf
CONFIG_LOGS=/custom/logs
# Replacing needed environment variables in config (envsubst will break $uri)
# Store final config in logs, for easier debugging
@aurelijusb
aurelijusb / README.md
Last active December 20, 2015 19:49
Augmented Reality: From zero to hero

Demo code for presentation

Shows 4 views of WebCam:

  • Original frames from WebCam
  • With Face detection
  • With Canny filter
  • With ThreashHold filter
@aurelijusb
aurelijusb / README.md
Created December 8, 2015 20:12
Lazy evealuation as callback

Visuals for prezentation: Being lazy in practice

@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 / REDME.md
Created December 2, 2015 19:43
Server-Client (server-localhost) example
@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 / 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-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 / 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 / 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