Skip to content

Instantly share code, notes, and snippets.

@iiidefix
iiidefix / ds_6_rc.txt
Created January 12, 2024 16:42
Teufel Decoderstation 6 Remote - DS 6 RC - IR codes
# power
IRSend {"Protocol":"NEC","Bits":32,"Data":"0x4040C03F"}
# sleep
IRSend {"Protocol":"NEC","Bits":32,"Data":"0x404040BF"}
# hdmi tv
IRSend {"Protocol":"NEC","Bits":32,"Data":"0x404022DD"}
# hdmi 1
IRSend {"Protocol":"NEC","Bits":32,"Data":"0x4040E01F"}
@iiidefix
iiidefix / pipe.php
Created March 7, 2022 06:34
simple php pipe function
<?php
function pipe($value, ...$funcs) {
return array_reduce($funcs, fn($v, $f) => $f($v), $value);
}
?>
@iiidefix
iiidefix / update_gitea.bash
Created March 28, 2019 09:23
script to update gitea
#!/bin/bash
v=$(wget -qO- https://api.github.com/repos/go-gitea/gitea/releases/latest | jq --raw-output '.tag_name')
readonly VER="${v#v}"
readonly BIN="gitea-${VER}-linux-amd64"
readonly SIG="${BIN}.asc"
readonly URL="https://dl.gitea.io/gitea/${VER}/"
verify_signature() {
@iiidefix
iiidefix / dnsdist.bash
Last active May 22, 2017 05:17
DNSDIST Dashboard
#!/bin/bash
csv-table2 () {
awk \
-F':' \
'{ printf "%-*s%*s\n",'$1',$1,'$2',$2}'
}
csv-table4 () {
awk \
'{ printf "%*s %-*s%*s%*s\n",'$1',$1,'$2',$2,'$3',$3,'$4',$4}'
@iiidefix
iiidefix / .htaccess
Last active June 18, 2023 16:25
A simple classless PHP regex router function
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ ./router.php/$1 [QSA]

Keybase proof

I hereby claim:

  • I am iiidefix on github.
  • I am iiidefix (https://keybase.io/iiidefix) on keybase.
  • I have a public key whose fingerprint is 2CE8 E643 9ABC 15A7 B9FA E10F 9E5F 4E65 D830 05B4

To claim this, I am signing this object:

@iiidefix
iiidefix / female.txt
Created August 4, 2016 09:01
Cloudflare nameserver names
abby
ada
adel
adi
adrian
aida
ali
alice
alina
alla
String.prototype.escapeHTML = function() {
var map = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#039;'
};
return this.replace(/[&<>"']/g, function(m) { return map[m]; });
};
function UUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = (c == 'x') ? r : (r&0x3|0x8);
return v.toString(16);
});
}
@iiidefix
iiidefix / StringTemplate.js
Last active November 6, 2023 05:22
Simple JS template engine
String.prototype.template = function (d) {
return this.replace(/\{([^\}]+)\}/g, function (m, n) {
var o = d, p = n.split('|')[0].split('.');
for (var i = 0; i < p.length; i++) {
o = typeof o[p[i]] === "function" ? o[p[i]]() : o[p[i]];
if (typeof o === "undefined" || o === null) return n.indexOf('|') !== -1 ? n.split('|')[1] : m;
}
return o;
});
};