Skip to content

Instantly share code, notes, and snippets.

View Achterstraat's full-sized avatar

Evert Achterstraat Achterstraat

View GitHub Profile
@Achterstraat
Achterstraat / SyncBlink2Synology.php
Created June 19, 2022 19:37
Use SSH, Telegram or any Webbrowser to Sync Amazon Blink Mediafiles to Synology (with or without Cronjobs)
<?php
class Blink
{
public $account = [
'credentials' => [
'email' => '',
'password' => '',
],
'region' => 'rest-prod.immedia-semi.com',
@Achterstraat
Achterstraat / Directadmin.sh
Created January 11, 2021 16:13
Accounts overview included domains, subdomains, pointers and mailaliases in tabbed list!
#!/bin/sh
if [ ! -z "${1}" ]; then user="${1}"; else user=""; fi
users=/usr/local/directadmin/data/users
virtual=/etc/virtual
for u in `ls ${users}/*/users.list`;
do
r=`echo ${u} | cut -d/ -f7`
if [ -z "${user}" ]; then echo -e "R: ${r}"; fi
for u in `cat ${u}; echo ${r}`;
@Achterstraat
Achterstraat / Vimexx.php
Last active July 25, 2023 08:50
Heb je het óók he-le-maal gehad met Vimexx? Gebruik dan dit script om makkelijk én snel de overstap te realiseren, alle data binnen enkele seconden over naar je nieuwe hostingpartij!
<?php
/*
First, create API Projects at https://www.vimexx.nl/api
Second, replace all vars between [] with credentials from previous step!
Third, see below;
$vimexx = (new \Vimexx([account], 'wefact'));
var_export($vimexx->post('/domains'));
var_dump($vimexx->client('whmcs')->post('/domain/dns', ['sld' => 'achterstraat', 'tld' => 'com']));
var_export($vimexx->client('wefact')->post('/domains'));
*/
@Achterstraat
Achterstraat / DirectAdmin.php
Last active August 3, 2019 08:52
Improved fetch_parsed_body() function that convert the results in an ordered array/object.
function fetch_parsed_body($object = false)
$result = json_decode($data, true);
if(is_null($result))
{
$result = [];
$lines = urldecode($this->result_body);
foreach(array_filter(explode("\n", $lines), 'strlen') as $line)
{
$key = (preg_match('~^([A-Z]{1,5})\=~', $line) ? strtok($line, '=') : false);
if(empty($key))
@Achterstraat
Achterstraat / cryptor.php
Created February 15, 2019 08:15
Extremely simple cryptor
function secret($string, $action = 'encrypt', $secret = 'random', $host = 'achterstraat.com', $method = 'AES-256-CBC')
{
switch($action)
{
case 'decrypt': {
return openssl_decrypt(base64_decode($string), $method, hash('sha256', $secret), 0, mb_substr(hash('sha256', $host), 0, 16));
}
default: {
return base64_encode(openssl_encrypt($string, $method, hash('sha256', $secret), 0, mb_substr(hash('sha256', $host), 0, 16)));
}
@Achterstraat
Achterstraat / dutch-license-plates.php
Created February 15, 2019 08:07
Dutch license plates
function license($string, $validate = false)
{
$licenses = [
'specials' => [
'koninklijk' => '~^AA(\d{2})$~',
'buitenlands' => '~^(B|G)N\d{4}$~',
'diplomatiek' => '~^CD[ABFJNST](\d{1,3})$~',
'NAVO' => '~^RC(\d{4})$~',
'militair' => '~^(DF|(\d{2})?(K(A|L-Z)|L(M|O|U)|MC|DM))~',
'landbouw' => '~^GV~',