Skip to content

Instantly share code, notes, and snippets.

@acirtautas
acirtautas / keys.py
Created August 7, 2015 14:03
Python script to read 1-4 key presses and log it to the file, q to quit
import termios, tty, sys, time
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
tty.setcbreak(sys.stdin)
try:
print('Waiting for key pressed [1,2,3,4] or [q] to quit')
while True:
@acirtautas
acirtautas / Vagrantfile
Last active January 27, 2016 22:42
Vagrant quick start with PHP
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/var/www/html", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
config.vm.provision "shell", inline: <<-SHELL
@acirtautas
acirtautas / augino_mociute.rb
Created March 29, 2015 10:49
Sonic PI melodies
# Augino mociute
use_bpm 34
use_synth :pretty_bell
astuntine = 0.125 #Eight note
ketvirtine = 0.25 #Quarter note
pusine = 0.5 #Half note
pilna = 1 #Whole note
@acirtautas
acirtautas / PrimeNumberDecomposition.php
Created July 15, 2014 13:28
Prime number decomposition
<?php
class PrimeNumberDecomposition
{
public static function Generate($number)
{
if (self::isPrime($number)) {
return [$number];
}
@acirtautas
acirtautas / .bashrc
Created May 20, 2014 07:10
Git linux configuration
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
@acirtautas
acirtautas / basketball_game_example_input.txt
Created May 19, 2014 18:18
Basketball game @ Facebook hacker cup 2014 qualification round
5
6 3 2
Wai 99 131
Weiyan 81 155
Lin 80 100
Purav 86 198
Slawek 80 192
Meihong 44 109
7 93 2
Paul 82 189
@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

@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 / 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 / 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.