Skip to content

Instantly share code, notes, and snippets.

View AndiDittrich's full-sized avatar
following the white rabbit

Andi Dittrich AndiDittrich

following the white rabbit
View GitHub Profile
@AndiDittrich
AndiDittrich / tomedo-make-external-api-call.scpt
Last active July 19, 2022 13:05
Tomedo - initiate external call via Apple Script for Grandstream Phones
-- Note: only supported in GXP21xx and GRP26xx series
-- Grandstream Phone Params - phone requires a statically assigned address or internal DNS name!
set PhoneAddr to "172.16.XXX.XXX"
set PhonePasswd to "mySecretPassphrase"
-- Tomedo replaces the xxx with the callee number
set CallTarget to "xxx"
-- execute webhook via curl http get
do shell script "curl -X GET \"http://" & PhoneAddr & "/cgi-bin/api-make_call?passcode=" & PhonePasswd & "&hs=1&phonenumber=" & CallTarget & "\""
@AndiDittrich
AndiDittrich / lighttpd.conf
Created September 12, 2020 09:39
WordPress multisite lighttpd mod_rewrite rules
# MU rewrites
url.rewrite-once = (
"^/(.*/)?files/$" => "/index.php",
"^/(.*/)?files/(.*)" => "/wp-content/blogs.php?file=$2",
"^(/wp-admin/.*)" => "$1",
"^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2",
"^/([_0-9a-zA-Z-]+/)?(.*\.php)" => "/$2",
"^/(.*)/?$" => "/index.php"
)
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
echo "https://home.url/";
echo ":)";
?&gt;</pre>
@AndiDittrich
AndiDittrich / Green.css
Created April 5, 2017 07:10
Custom EnlighterJS Theme modification based on "MooTwo.css"
/* Origin: https://github.com/AndiDittrich/EnlighterJS/blob/v2.10.1/Source/Themes/MooTwo.css */
/* Line 16,17,33 are modified to change the background color */
/* Inline specific styles */
span.greenEnlighterJS{
border-radius: 4px;
background-color: #f0f0f1;
border: solid 1px #f0f0f1;
}
@AndiDittrich
AndiDittrich / Hash.js
Created October 12, 2015 15:26
Simple Wrapper to access Node.js Hash functions provided by the buildin Crypto API
var _crypto = require('crypto');
// generic string hashing
function hash(input, algo, type){
// string input ?
if (typeof input !== 'string'){
input = JSON.stringify(input);
}
// create hash algo
@AndiDittrich
AndiDittrich / FetchRssFeed.js
Created October 12, 2015 10:36
Howto fetch & parse a RSS Feed with Node.js
var _request = require('request');
var _xml2js = require('xml2js').parseString;
function fetchFeed(url, cb){
_request({
url: url,
headers: {
'User-Agent': ' Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0'
}
}, function (error, response, xml){
@AndiDittrich
AndiDittrich / social.compiled.css
Last active August 29, 2015 14:28
Create Static Social-Media “Share” Buttons without Javascript
/* http://andidittrich.de/2015/08/create-static-social-media-share-buttons-without-javascript.html */
a.social-button {
display: inline-block;
width: 30px;
height: 30px;
border-radius: 15px;
line-height: 30px;
margin: 4px;
font-size: 18px;
font-weight: bold;
@AndiDittrich
AndiDittrich / AesUtil.js
Last active January 7, 2024 03:47
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// SPDX-License-Identifier: MPL-2.0
// AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// ----------------------------------------------------------------------------------------
// the encrypted datablock is base64 encoded for easy data exchange.
// if you have the option to store data binary save consider to remove the encoding to reduce storage size
// ----------------------------------------------------------------------------------------
// format of encrypted data - used by this example. not an official format
//
// +--------------------+-----------------------+----------------+----------------+