Skip to content

Instantly share code, notes, and snippets.

@acirtautas
acirtautas / arrays.php
Last active October 12, 2015 15:08
Strange php array reference behaviour. [FIXED]
<?php
$array = array('a', 'b', 'c');
foreach($array as $value) {
echo $value;
}
echo PHP_EOL;
foreach($array as &$value) {
@acirtautas
acirtautas / beautiful_strings.php
Created February 7, 2013 07:10
Beautiful strings @ Facebook hacker cup 2013 qualification round
<?php
/**
* Facebook Hacker Cup 2013 Qualification Round
*
* Beautiful strings
*
* @author Alfonsas Cirtautas
*/
// Read data
@acirtautas
acirtautas / balanced_smileys.php
Created February 7, 2013 07:15
Balanced Smileys @ Facebook hacker cup 2013 qualification round
<?php
/**
* Facebook Hacker Cup 2013 Qualification Round
*
* Balanced Smileys
*
* @author Alfonsas Cirtautas
*/
// Read data
@acirtautas
acirtautas / app.php
Created February 8, 2013 07:09
Example of PHP return on include, nice feature.
<?php
$data = include __DIR__.'/data.php';
var_dump($data);
@acirtautas
acirtautas / crontab.txt
Created September 20, 2013 05:54
Raspberry PI kiosk scripts
# crontab -e
# Every work day at 8:30 am
30 8 * * 1,2,3,4,5 /home/pi/bin/tvon.sh
# Every work day at 18:30 pm
30 18 * * 1,2,3,4,5 /home/pi/bin/tvoff.sh
@acirtautas
acirtautas / square_detector.php
Created November 22, 2013 08:56
Square detector @ Facebook hacker cup 2014 qualification round
<?php
/**
* Facebook Hacker Cup 2014 Qualification Round
*
* Square detector
*
* @author Alfonsas Cirtautas
*/
// Read data
@acirtautas
acirtautas / KillBillLinux.svg
Created December 19, 2013 14:37
Linux Kill Bill poster
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@acirtautas
acirtautas / triangle_coverage.php
Created January 21, 2014 14:49
Drawing random dots and triangle, calculating number of dots covered by this triangle.
<?php
$x = 1600;
$y = 800;
$n = 100;
$dots = random_dots($x, $y, $n);
@acirtautas
acirtautas / putty_mc_arch.md
Created March 31, 2014 21:17
Fixing putty's pseudo graphics on Arch

For my session in PuTTY:

  • Terminal > Keyboard > The function Keys and Keypad : Linux
  • Window > Translation > Received data assumed to be in which character set : ISO-8859-1(Latin-1)
  • Connection > Data > Terminal-type String : xterm-color
@acirtautas
acirtautas / Readme.md
Created May 2, 2014 07:34
Roman numerals

Roman Numerals

Installation

Download composer.phar from https://getcomposer.org/

curl -sS https://getcomposer.org/installer | php

Install dependencies