Skip to content

Instantly share code, notes, and snippets.

Avatar
following the white rabbit

Andi Dittrich AndiDittrich

following the white rabbit
View GitHub Profile
@AndiDittrich
AndiDittrich / lighttpd.conf
Created Sep 12, 2020
WordPress multisite lighttpd mod_rewrite rules
View lighttpd.conf
# 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"
)
View test.html
<pre class="EnlighterJSRAW" data-enlighter-language="php">&lt;?php
echo "https://home.url/";
echo ":)";
?&gt;</pre>
@AndiDittrich
AndiDittrich / Green.css
Created Apr 5, 2017
Custom EnlighterJS Theme modification based on "MooTwo.css"
View Green.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 Oct 12, 2015
Simple Wrapper to access Node.js Hash functions provided by the buildin Crypto API
View Hash.js
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 Oct 12, 2015
Howto fetch & parse a RSS Feed with Node.js
View FetchRssFeed.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 Aug 29, 2015
Create Static Social-Media “Share” Buttons without Javascript
View social.compiled.css
/* 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 Oct 7, 2021
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
View AesUtil.js
// 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
//
// +--------------------+-----------------------+----------------+----------------+