Skip to content

Instantly share code, notes, and snippets.

View filcab's full-sized avatar

Filipe Cabecinhas filcab

View GitHub Profile
@filcab
filcab / dhcp-leases-to-dns.rsc
Last active September 1, 2020 19:01 — forked from a-a/dhcp-leases-to-dns.rsc
MikroTik (RouterOS) script for automatically setting DNS records for clients when they obtain a DHCP lease
# MikroTik (RouterOS) script for automatically setting DNS records
# for clients when they obtain a DHCP lease.
#
# author SmartFinn <https://gist.github.com/SmartFinn>
# based on https://github.com/karrots/ROS-DDNS
# modified 20200412 a-a to allow multiple IPs per host
# modified 20200417 a-a, add functionality to strip anything after hostname, add variables to control optional features.
# modified 20200901 filcab, add a way to have a domain prefix for DHCP-related hostnames
# Set to "true" if adding multiple IP addresses to the same hostname is acceptable, ie for clients with wireless and a wire.
@filcab
filcab / openvpn-setup.md
Created September 12, 2016 22:28
Small OpenVPN setup tutorial

Setting up an OpenVPN server

References:

  • [Applied Crypto Hardening][ACH]
  • [Linode: Set up a hardened OpenVPN Server][Linode]
  • [Weak Diffie-Hellman and the Logjam Attack][WeakDH]
@filcab
filcab / alf-no-dead-strip.patch
Created January 3, 2015 22:07
afl-1.06b patch for no dead strip
diff -ru afl-1.06b/afl-gcc.c afl-1.06b-patched/afl-gcc.c
--- afl-1.06b/afl-gcc.c 2014-12-06 03:18:16.000000000 +0000
+++ afl-1.06b-patched/afl-gcc.c 2015-01-03 22:03:14.000000000 +0000
@@ -192,6 +192,11 @@
if (!strcmp(cur, "-pipe")) continue;
+ // Don't dead-strip for now since it might screw up some of our
+ // payloads, especially when subsections_via_symbols is emitted by the
+ // compiler (like clang does on MacOS X)
@filcab
filcab / clone-llvm-repo-git.sh
Last active August 29, 2015 14:11
clone llvm repo script
#!/usr/bin/env zsh
repo=$1
svn_repo=$repo
if [ "$repo" = "clang" ]; then
svn_repo=cfe
fi
echo "[*] Cloning $repo.git (based on $svn_repo/trunk)"
@filcab
filcab / out.txt
Created May 9, 2014 22:22
initial selection DAG weirdness
LLVM IR:
define <8 x double> @vsel_double8(<8 x double> %v1, <8 x double> %v2) {
%vsel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x double> %v1, <8 x double> %v2
ret <8 x double> %vsel
}
$ llc -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx -debug
@filcab
filcab / insertps.llc.txt
Created April 29, 2014 07:27
insertps llc output
Args: ../llvm-cmake/bin/llc -O3 -mattr=sse4.1 -o - insertps.ll -debug
Features:+64bit,+sse2,+sse4.1
CPU:generic
Subtarget features: SSELevel 6, 3DNowLevel 0, 64bit 1
.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 13, 1
********** Begin Constant Hoisting **********
********** Function: move_1_to_2
@filcab
filcab / insertps.ll
Created April 29, 2014 07:26
insertps-opt-U0YW+U0ZW
define <4 x i32> @move_1_to_2(<4 x i32> %x, <4 x i32> %a){
entry:
%vecext1 = extractelement <4 x i32> %x, i32 1
%vecext2 = extractelement <4 x i32> %x, i32 3
%vecinit2 = insertelement <4 x i32> undef, i32 %vecext1, i32 2
%vecinit3 = insertelement <4 x i32> %vecinit2, i32 0, i32 1
%vecinit4 = insertelement <4 x i32> %vecinit3, i32 %vecext2, i32 3
ret <4 x i32> %vecinit4
}
@filcab
filcab / gist:9340480
Created March 4, 2014 04:50
Know what you're doing
use Digest::MD5 qw(md5_hex);
$a = md5_hex('240610708');
$b = md5_hex('QNKCDZO');
print "$a\n";
print "$b\n";
print "\n";
print ($a == $b);
@filcab
filcab / gist:1166522
Created August 23, 2011 21:02
clang error in FreeBSD headers
filcab@aku ~/src> cat a.cpp 1 ↵ master*
#include <map>
typedef std::map<int, long> collection;
typedef collection::iterator iterator;
filcab@aku ~/src> clang++ a.cpp -c -o a.o -D_GLIBCXX_DEBUG master*
In file included from a.cpp:1:
In file included from /usr/include/c++/4.2/map:69:
In file included from /usr/include/c++/4.2/debug/map:39:
type RowState = !(Int, Int, String, TrackWords)
stN :: RowState -> Int
stN (n,_,_,_) = n
stRows :: RowState -> Int
stRows (_,rows,_,_) = rows
stTid :: RowState -> String
stTid (_,_,tid,_) = tid
stTw :: RowState -> TrackWords
stTw (_,_,_,tw) = tw
initialState :: RowState