Skip to content

Instantly share code, notes, and snippets.

View grooverdan's full-sized avatar
💭
compile, test, repeat

Daniel Black grooverdan

💭
compile, test, repeat
View GitHub Profile
#!/bin/bash
if [ $# -gt 1 ]; then
CLIENT=$1
HOSTNAME=$2
else
echo fail
exit 1
fi
@grooverdan
grooverdan / fail2ban IPv6
Created January 3, 2013 05:02
Fail2Ban IPv6 support - approaches
Fail2ban needs IPv6 support
===========================
Summary
-------
Fail2ban's IPv6 support in the underneath layers is easy enough but how do we process action files? A large number of user defined action files exist, some support IPv6 and some don't. Netfilter and other mechanism like ipset can sometimes require a totally different set of tools to deal with IPv4 vs IPv6. To complicate this more it may be needed to block IPv6 network addresses rather than individual IPv6 addresss as they are often handed out in block. An attacker could quite easily control a /64 IPv6 addresss pace and the single banning approach of IPv4 may not be as effective.
/* from include/my_compiler.h */
#if defined __GNUC__ || defined __SUNPRO_C || defined __SUNPRO_CC
/* Specifies the minimum alignment of a type. */
# define MY_ALIGNOF(type) __alignof__(type)
/* Determine the alignment requirement of a type. */
# define MY_ALIGNED(n) __attribute__((__aligned__((n))))
/* Microsoft Visual C++ */
#elif defined _MSC_VER
# define MY_ALIGNOF(type) __alignof(type)
cat align-test.c
#include <stdlib.h>
/* from include/my_compiler.h */
#if defined __GNUC__ || defined __SUNPRO_C || defined __SUNPRO_CC
/* Specifies the minimum alignment of a type. */
# define MY_ALIGNOF(type) __alignof__(type)
/* Determine the alignment requirement of a type. */
$ cat ~/fdmain.c
#include <unistd.h>
#include <stdio.h>
int main()
{
FILE *newstdout;
newstdout = freopen("/tmp/xx.txt", "w", stdout);
@grooverdan
grooverdan / build gcc and binutils
Created July 21, 2017 00:31
build gcc and binutils
#!/bin/bash
set -xeuo pipefail
T=$(mktemp -d /tmp/XXXXX)
configure_gcc()
{
../configure --prefix=/toolchain --disable-multilib --enable-languages=c,c++
}
gis.gis_bugs_crashes w60 [ fail ]
Test ended at 2017-07-21 03:30:31
CURRENT_TEST: gis.gis_bugs_crashes
--- /source/mysql-test/suite/gis/r/gis_bugs_crashes.result 2017-07-21 06:23:33.762428753 +0300
+++ /build/build/mysql-test/var/60/log/gis_bugs_crashes.reject 2017-07-21 06:30:31.120689033 +0300
@@ -1424,20 +1424,20 @@
POLYGON((0 15,5 0,25 0,30 15,15 25,0 15))
SELECT ST_ASTEXT(ST_BUFFER(ST_GEOMFROMTEXT(@star_of_elems), 1));
ST_ASTEXT(ST_BUFFER(ST_GEOMFROMTEXT(@star_of_elems), 1))
#ifdef HAVE_LIBNUMA
if (srv_numa_enable) {
else
#endif
{
for....
}
@grooverdan
grooverdan / travis.yml
Created June 8, 2018 04:28
kernel build matrix travis
dist: trusty
sudo: false
language: c
service:
- docker
env:
matrix:
- BASE=ubuntu:14.04
- BASE=ubuntu:16.04
- BASE=ubuntu:18.04
@grooverdan
grooverdan / gist:136f7cec0cedf67d13608c797d9eccca
Created July 12, 2019 03:56
build caddy multiarch docker manifest
#!/bin/sh
set -v -x
version=v1.0.1
imagebase=caddyserver/caddy:${version}
images=""
# docker manifest is old, consistent but still experimental (for no great reason)
# mkdir -p ~/.docker