Skip to content

Instantly share code, notes, and snippets.


Christian Haschek geek-at

View GitHub Profile
geek-at / zfs_sync.php
Created Feb 28, 2022
PHP script that syncs remote ZFS snapshots to local dataset. Works with encrypted volumes
View zfs_sync.php
Script that syncs remote zfs snapshots to a local zfs target.
Can sync remote encrypted datasets without ever needing to know the key on the local machine.
It will automatically search for the last snapshot in common with the remote host and only sync the differences.
If it doesn't find any local ones or has none in common, it will sync the oldest snapshot of the remote machine.
Meant to be run as cronjob
View coindata.php
* Coin Dashboard by Christian Haschek
* Donations always welcome
* BTC: 1ChrisHMgr4DvEVXzAv1vamkviZNLPS7yx
* ETH: 0x1337C2F18e54d72d696005d030B8eF168a4C0d95
*
geek-at /
Created Aug 13, 2020
The script used to trash a banking phishing site
while :; do
verf=$(cat /dev/urandom | tr -dc '0-9' | fold -w 8 | head -n 1)
pin=$(cat /dev/urandom | tr -dc '0-9' | fold -w 5 | head -n 1)
ip=$(printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))")
geek-at / smartmeter.ino
Created Oct 19, 2018
Example script to log flashing light to influxdb via UDP. See for more info
View smartmeter.ino
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
WiFiUDP Udp;
const char* ssid = "yourwifiSSID";
const char* password = "yourwifipassword";
const int threshold = 400; //this is the threshold how high the value has to be to be registered as a flash.
//400 works great for me since flashes are usually ~600
IPAddress remoteIP(192,168,1,117); // the IP address of your Influxdb server
geek-at / zfs_sync_snapshots.php
Last active Jan 1, 2022
PHP script to receive all zfs snapshot of dataset from remote machine to local
View zfs_sync_snapshots.php
$remoteIP = $argv[1];
$remoteDataset = $argv[2];
$localDataset = $argv[3];
if($argc!=4) exit('usage: php sync.php <remote ip> <remote dataset> <local dataset>'.PHP_EOL);
$cmd_zfs = "zfs list -t snapshot $remoteDataset | cut -d ' ' -f 1 | cut -d '@' -f 2 | tail -n +2";
geek-at / parse_austria.php
Last active Apr 15, 2021
Parsing ip data from a file
View parse_austria.php
$infile = 'austria.csv';
$outfile = 'austria.ips';
$fp = fopen($outfile,'w');
$handle = fopen($infile, "r");
if ($handle)
while (($line = fgets($handle)) !== false) {
$line = trim($line);
geek-at /
Created Aug 10, 2020
Python example for
import requests
import json
url = ''
files = {'image':('1.jpg', open('1.jpg', 'rb'))}
r =, files=files)
result = json.loads(r.content)
print("This image is classified as "+str(result["data"]["classification"]))
geek-at / example.js
Created Aug 10, 2020
Node JS example for
View example.js
const request = require('request')
const fs = require('fs');
var req ="", function (err, resp, body) {
if (err) {
} else {
var json = JSON.parse(body)
console.log("This image has been classified as",
geek-at /
Created Aug 10, 2020
Bash example for
# Test image1.jpg
curl -s -F "image=@image1.jpg" ""
# Let the API analyze an externally hosted image
curl -s ""
geek-at / example.php
Created Aug 10, 2020
PHP example for
View example.php
$nsfw = new NSFW();
// Example 1: upload images to check later
$results = $nsfw->uploadFile('image1.jpg',true);
echo "Classification done. Image is {$results['classification']}".PHP_EOL;