Skip to content

Instantly share code, notes, and snippets.

Avatar

Evert Achterstraat Achterstraat

View GitHub Profile
@Achterstraat
Achterstraat / SyncBlink2Synology.php
Created Jun 19, 2022
Use SSH, Telegram or any Webbrowser to Sync Amazon Blink Mediafiles to Synology (with or without Cronjobs)
View SyncBlink2Synology.php
<?php
class Blink
{
public $account = [
'credentials' => [
'email' => '',
'password' => '',
],
'region' => 'rest-prod.immedia-semi.com',
@Achterstraat
Achterstraat / Directadmin.sh
Created Jan 11, 2021
Accounts overview included domains, subdomains, pointers and mailaliases in tabbed list!
View Directadmin.sh
#!/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 May 26, 2022
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!
View Vimexx.php
<?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 Aug 3, 2019
Improved fetch_parsed_body() function that convert the results in an ordered array/object.
View DirectAdmin.php
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 Feb 15, 2019
Extremely simple cryptor
View cryptor.php
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)));
}
View dutch-license-plates.php
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~',