View transmission-proxy.php
<?php
$auth = "username:password";
$url = "http://hostname:9091/transmission/rpc";
ini_set ("display_errors", false);
ini_set ("log_errors", true);
error_reporting (E_ALL);
if (!isset ($_SERVER["PHP_AUTH_USER"]) || !isset ($_SERVER["PHP_AUTH_PW"])) {
header ('WWW-Authenticate: Basic realm="transmission-proxy"', true);
View flickr-download.sh
#!/bin/bash
photoset=72157657937398483
flickcurl photosets.getPhotos "$photoset" | grep -E '^photo with URI .+ ID [0-9]+ and [0-9]+ tags$' | grep -Eo '[0-9]{11,}' | sort --random-sort | while read -r flickrid ; do
if [ "$flickrid" -eq "$flickrid" ] 2>/dev/null ; then
url=$(flickcurl photos.getSizes $flickrid | grep -Ei '^ source http.+[o]\.jpg$' | grep -Eoi 'http.+\.jpg$' | head -1)
if [[ "$url" =~ ^http.+\.[jJ][pP][gG]$ ]] ; then
wget --quiet "$url"
fi
View feedrarbg.php
<?php
error_reporting (E_ALL);
ini_set ("display_errors", true);
$BASE = strtok (basename ($_SERVER["SCRIPT_NAME"], ".php"), "-");
libxml_use_internal_errors (false);
function clear_dates ($str) {
return preg_replace ("/(\<updated\>)[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}\:[0-9]{2}\:[0-9]{2}\+[0-9]{2}\:[0-9]{2}(\<\/updated\>)/m", "\\1\\2", $str);
View feedimdb.php
<?php
error_reporting (E_ALL);
ini_set ("display_errors", true);
$BASE = strtok (basename ($_SERVER["SCRIPT_NAME"], ".php"), "-");
function clear_dates ($str) {
return preg_replace ("/(\<updated\>)[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}\:[0-9]{2}\:[0-9]{2}\+[0-9]{2}\:[0-9]{2}(\<\/updated\>)/m", "\\1\\2", $str);
}
View crontab.php
<?php
#run on a remote machine's crontab:
#13 * * * * curl --silent http://example.com/crontab.php
#and run on the server's crontab:
#*/5 * * * * cd ~/public_html && php crontab.php
if (PHP_SAPI == "cli") {
file_put_contents ("crontab" . (!empty ($_SERVER["argv"][1]) && preg_match ("/^[a-z_][a-z0-9_]{0,30}$/i", $_SERVER["argv"][1]) ? "-{$_SERVER["argv"][1]}" : "") . ".date", time (), LOCK_EX);
} else {
header ("content-type: text/plain", true);
View logchk.php
<?php
ini_set ("display_errors", true);
if (!empty ($_SERVER["argv"][1])) $name = $_SERVER["argv"][1];
if (empty ($name)) $name = substr ($_SERVER["PWD"], strrpos($_SERVER["PWD"], "/")+1);
define ("datepath", "/var/log/user/logchk-$name.date");
$last = 0;
if (file_exists (datepath)) {
View ddns-curl.sh
#!/bin/bash
#run from crontab:
#*/5 * * * * ~/bin/ddns-curl.sh
host="example.myvnc.com"
if [ $EUID -ne 0 ] ; then echo 'you are not root' >&2 ; exit 1 ; fi
oldip=$(cat /var/cache/user/ip.txt 2>/dev/null)
View imdb-export.php
<?php
define ("id", 'secretkey');
$USER="123456789";
$curl = curl_init ("http://www.imdb.com/list/export?list_id=ratings&author_id=ur$USER");
curl_setopt_array ($curl, array (
CURLOPT_ENCODING => "",
CURLOPT_COOKIE => "id=".constant("id"),
CURLOPT_RETURNTRANSFER => true,
View sorozatbarat-export.php
<?php
$DOMAIN="www.sorozat-barat.club";
$USER="user";
$PASSWORD="secret";
$curl = curl_init ("https://$DOMAIN/login");
curl_setopt_array ($curl, array (
CURLOPT_ENCODING => "",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
View qr.sh
#!/bin/bash
echo 'INFO usage syntax: qr.sh "*foobar*"' >&2
path=.
if [ -n "$1" ] ; then path="$1" ; fi
find $path -name '*.url' | while read -r file ; do
urls.sh "$file" 2>/dev/null | grep 'imdb.com/title/tt' | qrencode --size=3 --level=L --margin=8 --output=- | convert - +level 0%,50% "$(dirname "$file")/$(basename "$file" .url).png"
done