Skip to content

Instantly share code, notes, and snippets.

View Great-Antique's full-sized avatar

Denys Hirnyk Great-Antique

View GitHub Profile
@Great-Antique
Great-Antique / ServiceLocator.php
Created September 23, 2015 14:52
Simple PHP Service Locator
<?php
/**
* Class ServiceLocator
*
* Simple service locator class
*/
class ServiceLocator implements ServiceLocatorInterface
{
@Great-Antique
Great-Antique / music-mover.php
Created August 28, 2015 16:42
Move music: BandName/01 - Test Name.mp3 -> OneFolder/BandName - 1 - Test Name.mp3
#!/usr/bin/env php
<?php
/*
* Run php ./music-mover.php ../path/to/bands/folder ../path/to/one/folder [-d|--debug]
* DEBUG MODE: echos moving way instead of moving files
*/
function l($text) {
echo "{$text}\n";
@Great-Antique
Great-Antique / mau-timetable-parse-from-kiev.js
Last active October 15, 2015 10:23
Get destination from Kyiv and its last month from timetable from MAU (UIA) airlines site
/**
* Just run from console
* Url of timetable: http://www.flyuia.com/ua/information-and-services/destinations/timetable.html
*/
var destinations = {};
var origins = ['Київ'];
var excludeDestinations = [
'Самара', 'Казань', 'Кишинів', 'Мінськ', 'Єреван', 'Москва (DME)', 'Калінінград', 'Санкт-Петербург',
'Запоріжжя', 'Одеса', 'Львів', 'Харків',
@Great-Antique
Great-Antique / mau-timetable-from-kiev.md
Last active October 15, 2015 10:25
MAU (UIA) timetable from Kyiv

Result on 2015-10-15

Destination Last date
Амстердам 24-OCT
Лондон 31-DEC
Париж 24-OCT
Брюссель 24-OCT
Гельсінкі 23-OCT
@Great-Antique
Great-Antique / rename-music.bash
Created June 19, 2015 22:53
rename folder with music
#!/usr/bin/env bash
a=(`ls --format=single-column --color=no | awk '{gsub(/ /, "_"); print}'`)
for b in "${a[@]}"
do
c=`echo $b | awk -F'.' '{print $1" - "}'`
d=`echo $b | awk -F'_-_' '{print $2}' | awk -F'_\(' '{print $1}' | awk '{gsub(/_/, " "); print}'`
e=`echo $b | awk '{gsub(/_/, " "); print}'`
# /etc/X11/xorg.conf.d/01-synaptics.conf
Section "InputClass"
Identifier "e440 top buttons"
MatchDriver "synaptics"
# right btn|middle btn
Option "SoftButtonAreas" "60% 0 0 0 40% 60% 0 0"
Option "HorizHysteresis" "30"
Option "VertHysteresis" "30"
Option "PalmDetect" "1"
# /etc/X11/xorg.conf.d/01-synaptics.conf
Section "InputClass"
Identifier "t440 top buttons"
MatchDriver "synaptics"
# right btn|middle btn
Option "SoftButtonAreas" "60% 0 0 0 40% 60% 0 0"
Option "HorizHysteresis" "30"
Option "VertHysteresis" "30"
Option "PalmDetect" "1"
@Great-Antique
Great-Antique / linkchecker-to-junit.sh
Last active August 29, 2015 14:03
Convert LinkChecker xml result to junit xml format for Bamboo
#!/usr/bin/env php
<?php
/**
* Convert LinkChecker xml result to junit xml format for Bamboo
* Usage:
* 1) run LinkChecker
* linkchecker --ignore-url=\!mysite\.localhost http://mysite.localhost --complete > log.xml
* 2) run this script
* cat log.xml | ./linkchecker-to-junit.sh > result.xml
webcheck --avoid-external --base-only --output=log http://localhost:8000/ -x /blog -f
linklint -http -host localhost:8000 /@ -doc log_dir