This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
new class | |
{ | |
public function __construct () | |
{ | |
$args = explode("\n", trim(file_get_contents('php://stdin'))); | |
$carg = count($args); | |
$this->log('===== Action started === %d path(s) to process =====', $carg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
for a in {30..47}; do (for b in {0..9}; do echo -n "\x1b[$b;$a""m" " $b;$a \x1b[0m";done;); echo "\x1b[0m"; done | |
for a in {90..107}; do (for b in {0..9}; do echo -n "\x1b[$b;$a""m" " $b;$a \x1b[0m";done;); echo "\x1b[0m"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Install any build dependencies needed for curl | |
sudo apt-get build-dep curl | |
# Get latest (as of Feb 25, 2016) libcurl | |
mkdri | |
cd ~/curl | |
wget https://curl.haxx.se/download/curl-7.54.0.tar.bz2 | |
tar -xvjf curl-7.54.0.tar.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
/** | |
* Options: | |
* -r rev_from:rev_to -- revision range to export | |
* -u username -- svn username (optional) | |
* -p password -- svn password (optional) | |
* -n -- export with uncommited files (optional) | |
*/ | |
$opts = getopt('r:u:p:n'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$status = shell_exec('svn status --non-interactive'); | |
if (strlen(trim($status)) > 0) | |
{ | |
$status = explode("\n", trim($status)); | |
echo("Syncing repository...\n"); | |
foreach ($status as $item) | |
{ | |
if (preg_match('/^\?\s+(.*)(?<!CVS\/Entries\.Log)$/', $item, $match)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function check_pwz_number ($number) | |
{ | |
if (strlen($number) != 7 || preg_match('/^0+$/', $number)) return false; | |
$c = (int)$number[0]; | |
$n = substr($number, 1); | |
$s = 0; | |
for ($i = 1; $i <= 6; $i ++) $s += (int)$n[$i - 1] * $i; | |
return ($s % 11) == $c ? true : false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function check_do_number ($number) | |
{ | |
$t = 0; | |
$n = array(); | |
$w = array(7, 3, 1); | |
if (!preg_match('/^([A-Z]+)(\d{1})(\d+)$/', strtoupper($number), $n)) return false; | |
foreach (str_split($n[1] . $n[3]) as $i => $l) | |
$t += $w[$i % 3] * (is_numeric($l) ? $l : (ord($l) - 55)); | |
return ($t % 10) == (int)$n[2] ? true : false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function check_regon_number ($number) | |
{ | |
$w = array(7 => array(2, 3, 4, 5, 6, 7), 9 => array(8, 9, 2, 3, 4, 5, 6, 7), 14 => array(2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8)); | |
if (!isset($w[$l = strlen($number = preg_replace('/[^0-9]/', '', $number))])) return false; | |
for ($s = $i = 0; $i < $l - 1; $i ++) | |
$s += $number[$i] * $w[$l][$i]; | |
return $number[$l - 1] == (($s % 11) % 10); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function check_nip_number ($number) | |
{ | |
$w = array(6, 5, 7, 2, 3, 4, 5, 6, 7); | |
if (($l = strlen($number = preg_replace('/[^0-9]/', '', $number))) !== count($w) + 1) return false; | |
for ($s = $i = 0; $i < $l - 1; $i ++) | |
$s += $number[$i] * $w[$i]; | |
return (10 > ($c = ($s % 11))) && $number[$l - 1] == $c; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function check_pesel_number ($number) | |
{ | |
$w = array(1, 3, 7, 9, 1, 3, 7, 9, 1, 3); | |
if (($l = strlen($number = preg_replace('/[^0-9]/', '', $number))) !== count($w) + 1) return false; | |
for ($s = $i = 0; $i < $l - 1; $i ++) | |
$s += $number[$i] * $w[$i]; | |
return $number[$l - 1] == ((10 - ($s % 10)) % 10); | |
} |