TigerVPN Lite: Lifetime Subscription for 29$

26/09/2015 1 comment

TigerVPN Lite offer:

  • Provides top-notch security
  • Encrypts all your browsing w/ a 256bit SSL encryption
  • Includes 10Gbps servers optimized to limit latency globally
  • Offers access to 15 nodes (of the 61 available) covering 41 countries & 5 continents
  • Doesn’t limit your data; plus bandwidth health detection maintains performance at peak times
  • Includes easy-to-use mobile apps
  • Allows for a choice in encryption protocol – PPTP, L2TP, OpenVPN, etc.

Tiger VPN Lifetime subscription for $29

Categories: Uncategorized

Send email when medical results appear on lam24.pl

24/09/2015 Leave a comment

Bellow php script will check every 15 min if medical results appear on lam24.pl and send email with notification.


<?php
$url = "https://lam24.pl/wyniki.aspx&quot;;
$zlecenie = "xxxxxxxxx";
$pesel = "xxxxxxxxxxx";

$f = "lam24.ini";
$size = filesize($f);
$fH = fopen($f,"r");
$data = fread($fH,$size);
fclose($fH);
if(strpos($data,'true') !== false) {
exit();
}

$ckfile = tempnam("/tmp", "CURLCOOKIE");
$useragent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

$html = curl_exec($ch);

curl_close($ch);

preg_match('~~', $html, $viewstate);
preg_match('~~', $html, $eventValidation);

$viewstate = $viewstate[1];
$eventValidation = $eventValidation[1];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

$postfields = array();
$postfields['__EVENTTARGET'] = "";
$postfields['__EVENTARGUMENT'] = "";
$postfields['__VIEWSTATE'] = $viewstate;
$postfields['__EVENTVALIDATION'] = $eventValidation;
$postfields['Login$UserName'] = $zlecenie;
$postfields['Login$Password'] = $pesel;
$postfields['Login$loginButton'] = 'Pokaż wyniki';

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$ret = curl_exec($ch);
if(strpos($ret,'Nie znaleziono wynik') !== true) {
$fp = fopen($f, 'w');
fwrite($fp, 'true');
fclose($fp);

$to = 'user@gmail.com';
$subject = 'Wyniki Lam24';
$message = 'Automatyczny skrypt, ktory sprawdza dostepnosc wynikow co 15 minut informuje za sa one juz dostepne:' . "\r\n" . 'https://lam24.pl/wyniki.aspx' . "\r\n" .
'Zlecenie: ' . $zlecenie . "\r\n" .
'Pesel: ' . $pesel;
$headers = 'From: user@domain.pl' . "\r\n" .
'Reply-To: user@domain.pl' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
}
curl_close($ch);
?>

crontab:
*/15 * * * * /usr/bin/php /home/n4p1/lam24/lam24.php

Categories: Bash, PHP + MySQL

Godziny otwarcia basenu w Malborku

24/09/2015 Leave a comment

Poniedziałek: 7:00, 13:35 , 20:45
Wtorek: 7:00
Środa: 7:00, 13:35
Czwartek: 7:00, 14:30, 20:45
Piątek: 7:00, 14:30
Sobota: 13:00, 14:00, 15:00, 16:00, 17:00
Niedziela: 13:00, 14:00, 15:00, 16:00, 17:00

Stan na 2015-10-06

Categories: Uncategorized

Adobe presets for GoPro footage

23/09/2015 Leave a comment

Blur and Sharpen:
Sharpen 50

Color Correction:
Brightness 15
Contrast 20

Image Control:
Gamma 14

Difference:
dinopark.mp4_snapshot_00.07_[2015.09.23_21.45.32]

Categories: Uncategorized

Rename files based on their creation date

19/10/2014 1 comment


#!/bin/bash
for i in Filmy/*.mp4
do
mod_date=$(stat -c "%y" "$i"|sed 's/\..*$//'|sed 's/\ /\_/'|tr -d ':'|tr -d '-')
mv "$i" "$mod_date".MP4
done

Categories: Uncategorized

How to download “past broadcasts” from twitch.tv

08/08/2013 2 comments

Unfortunately justin api no longer support twitch.tv channels and new twitch api doesn’t show direct links for flv videos. But fortunately we can still use listing by archive id using this url:
http://api.justin.tv/api/broadcast/by_archive/yyyyyyyyy.json

So, lets adopt our previous source to get fully working code in php witch download all videos from our favorite twitch channel:

<?php
$url = "https://api.twitch.tv/kraken/channels/xxxxxxx/videos?limit=100&broadcasts=true";

$c = curl_init($url);
$options = array(
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_HTTPHEADER => array('Content-type: application/json'),
	CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => 2
);
curl_setopt_array( $c, $options );
$json = curl_exec($c);
$json_a = json_decode($json,true);

foreach($json_a['videos'] as $v) {
	$id = $v['_id'];
	$id = preg_replace('/[^0-9.]+/', '', $id);
	if(!history_check($id)){
		$vid = "http://api.justin.tv/api/broadcast/by_archive/$id.json";
		$d = curl_init($vid);
		$options2 = array(
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_HTTPHEADER => array('Content-type: application/json')
		);
		curl_setopt_array( $d, $options2 );
		$json2 = curl_exec($d);
		$json2_a = json_decode($json2,true);
		exec('wget --progress=dot:mega -c '.$json2_a[0]['video_file_url'].' -O "downloads/'.$json2_a[0]['start_timestamp'].' - '.format_title($json2_a[0]['title']).'.flv"', $array,$exit_code);
		echo 'Exit code: '.$exit_code."\n";
		echo $array;
		echo "\n";
		history_add($id);
		echo implode('"\n"', $array);
	}
}

function format_title($title){ //format title and limit to 50 chars
	$out = preg_replace('/[^a-zA-Z \.]/','', $title);
	$out = substr($out, 0, 50); 
	return $out;
}
function history_check($date){
	$data = file_get_contents('history');

	if(strpos($data, $date) !== FALSE)
	{
		$out = TRUE;
	}
	else
	{
		$out = FALSE;
	}
return $out;
}

function history_add($date){
	file_put_contents('history', $date."\n", FILE_APPEND);
}
?>
Categories: Uncategorized

Bebiko Junior competition (bebiklub.pl)

16/07/2013 Leave a comment

Friend of mine participate in competition on bebiklub.pl – just a simple vote system. Unfortunately I can’t see on which place she is, there is no such a functionality, so I need to implement it by myself. As usual I choice php for that:

<?php
for($z=0;$z<=2960;$z=$z+10){
$url='https://www.bebiklub.pl/home/nowe-bebiko-junior/odpowiedzi-konkursowe/?start='.$z;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$in = curl_exec($ch);
curl_close($ch);

preg_match_all('/data-votes="(.*)" data-name="(.*)" data-id/i', $in, $out);
$k=count($out[1]);
for($i=0;$i<=$k-1;$i++){
        echo $out[2][$i].';';
        echo $out[1][$i]."\n";
}
}
?>

It will output a list of nicknames and votes in format:
nick;number_of_votes
Afterwards that output can be imported to excel and sorted.

Btw. Don’t forget to vote!

Categories: Bash