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 / 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:

@hexathos
hexathos / 2015-08-06 (hexathos) eraagentinstaller.diff
Last active August 29, 2015 14:26
Useless Code in Eset's EraAgentInstaller.sh
35,40d34
< if test -z $eraa_installer_url
< then
< echo "No installer available for '$arch' arhitecture. Sorry :/"
< exit 1
< fi
<
rbendig@zwiby:~$ dig nosslsearch.google.com @8.8.8.8
; <<>> DiG 9.9.5-4.3ubuntu0.2-Ubuntu <<>> nosslsearch.google.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38158
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
<?xml version="1.0" encoding="UTF-8" ?>
<feedback>
<report_metadata>
<org_name>google.com</org_name>
<email>noreply-dmarc-support@google.com</email>
<extra_contact_info>http://support.google.com/a/bin/answer.py?answer=2466580</extra_contact_info>
<report_id>11092558519225687717</report_id>
<date_range>
<begin>1404950400</begin>
<end>1405036799</end>