Skip to content

Instantly share code, notes, and snippets.

@hexathos
hexathos / gist:1f46149746f770ffddcde554b9b2d81c
Last active February 6, 2023 21:52
ip masking in nginx
map $remote_addr $remote_addr_anon {
~(?P<ip>\d+\.\d+)\. $ip.0.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
map $http_x_forwarded_for $http_x_forwarded_for_anon {
~(?P<ip>\d+\.\d+)\. $ip.0.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
@hexathos
hexathos / function_genUUID.php
Created November 18, 2012 01:15
Create UniqueID in php
<?php
function genUUID($prefix=null,$maxlength=36)
{
$s = strtoupper(
hash(
'whirlpool',hash('sha1',
microtime(true).crypt(
uniqid(
rand(),
true)
@hexathos
hexathos / hxfunctions-reduced.sh
Last active April 3, 2018 04:40
Morning Tweets
function checkForPid {
lockfile=${1}
if [ -f ${lockfile} ] ; then
runningpid=$(cat ${lockfile})
if ps -p${runningpid} >/dev/null
then
runningpid=$(cat ${lockfile})
echo "${0##*/} wird bereits ausgeführt (PID ${runningpid})"
ps -p${runningpid} -u
exit 1
#!/bin/bash
jenkinsjobname=<INSERT>
jenkinsbuildtoken=<INSERT>
jenkinsusername=<INSERT>
jenkinspasswordhash=<INSERT>
jenkinsurl=<INSERT>
while read oldrev newrev refname
do
@hexathos
hexathos / evelog2speech.sh
Last active October 5, 2017 20:12
EVE GameLogs to speech on linux
## ONE logfile
tail -n1 -f logfilename | sed 's/.*)//' -u | sed 's/<[^>]\+>//g' -u | espeak -ven-us+f5 -s1600 --pho
## Multiple Logfiles with cachefile
#this must run in background, or any other console
tail -n1 -f * | grep -v "==" --line-buffered | sed 's/.*)//' -u | sed 's/<[^>]\+>//g' -u >>~/Documents/eve.log
#this is for text2speech conversion
tail -f ~/Documents/eve.log | espeak -ven-us+f5 -s1600 --pho
@hexathos
hexathos / gist:a9a7f0e99b5ebf32afe5490789c2d775
Last active June 14, 2017 07:37
name parameters in sophos av not working
The following output is generated by savscan with hashs
md5 1bb08a3214461dcda0fcb3c7931c419b /opt/sophos-av/bin/savscan
sha512 193a8094f1eb1e3b6793e08194a85dda17faeed00e702b771a96bf5b1cb270d336b53036412b8b1d0006aa8adeb80651f117d2157c83b9a7534e193dd975037c /opt/sophos-av/bin/savscan
I would expect to get output of scanned files, according to -dn parameter and
file details, according to --show-file-details, but none of them seems to get
used by savscan
@hexathos
hexathos / example.php
Last active June 12, 2016 05:50
Get unicode hexadecimal value from fontawesome's _variables.scss (works on 4.6.3)
<?php
// For example if you need to print a fontawesome icon on an image... or as dropdown in a select box...
// works with fontawesome 4.6.3
// proof of concept, maybe a bit slow -.-
$in = file_get_contents('_variables.scss');
$out = array();
preg_match_all("/fa-var-(.*): \"\\(.*)\";/", $in, $out);
$result = array();
$count=0;

Keybase proof

I hereby claim:

  • I am hexathos on github.
  • I am hexathos (https://keybase.io/hexathos) on keybase.
  • I have a public key ASB-SkX8Pd-fqW5eW7YuO3ul4-zI9gTtVXYvtqfkp8twVgo

To claim this, I am signing this object:

mrbendig@zix:~/downloads$ sudo dpkg -i brackets-sprint-33-LINUX64.deb
[sudo] password for mrbendig:
Vormals nicht ausgewähltes Paket brackets wird gewählt.
(Lese Datenbank ... 132024 Dateien und Verzeichnisse sind derzeit installiert.)
Entpacken von brackets (aus brackets-sprint-33-LINUX64.deb) ...
brackets (0.33.0-10188) wird eingerichtet ...
Trigger für hicolor-icon-theme werden verarbeitet ...
Trigger für menu werden verarbeitet ...
mrbendig@zix:~/downloads$ brackets
/usr/bin/brackets: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by /usr/bin/brackets)
@hexathos
hexathos / function_getTimeFromNTPServer.php
Created November 18, 2012 02:04
getTimeFromNTPServer - PHP
<?php
/**
* This function is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This Software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU