Skip to content

Instantly share code, notes, and snippets.

sbz / gist:3c23c52d6817246b3682922944a9c3ba
Created Mar 25, 2021
crowdsec patch uuid for BSD systems
View gist:3c23c52d6817246b3682922944a9c3ba
diff --git c/cmd/crowdsec-cli/machines.go w/cmd/crowdsec-cli/machines.go
index bbdf11c..33e87e9 100644
--- c/cmd/crowdsec-cli/machines.go
+++ w/cmd/crowdsec-cli/machines.go
@@ -7,6 +7,7 @@ import (
+ "runtime"
sbz /
Last active Aug 19, 2019
Initialize terraform environment
set -o errexit
set -o nounset
set -o pipefail
readonly TF_VERSION="v0.11"
output_line() {
sbz /
Last active May 7, 2019
Detect useless ResourceRecord with type 'A' on AWS R53 pointing to private IP which doesn't exist in the region anymore
#!/usr/bin/env python3
import ipaddress
import boto3
from pprint import pprint as pp
# This script iterate over our regions in order to collect all the private IPs
# and check if the ResourceRecord created has still an existing IPs
sbz /
Last active May 30, 2018
Run pyflame against your python code, to profile it and generate a flamegraph (here it's against singularity-monitor)
sudo apt-get install -y autoconf automake autotools-dev g++ pkg-config python-dev python3-dev libtool make
[ ! -f ./ ] && {
curl -O
[ ! -f /usr/local/bin/pyflame -o ! -d pyflame ] && {
git clone
cd pyflame
sbz / tty-size.c
Created Apr 14, 2017
get terminal size using ioctl get win size (TIOCGWINSZ) in C
View tty-size.c
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
main(void) {
struct winsize ws;
printf ("lines %d\n", ws.ws_row);
sbz /
Last active Sep 27, 2017
get terminal size using ioctl get win size (TIOCGWINSZ) in Python
import termios
import fcntl
import os
import struct
with open(os.ctermid(), 'r') as fd:
packed = fcntl.ioctl(fd, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0))
rows, cols, h_pixels, v_pixels = struct.unpack('HHHH', packed)
print rows, cols, h_pixels, v_pixels
sbz /
Created Feb 4, 2015
mz-tab-urls: Get Mozilla Firefox tabs URLs on stdout
#!/usr/bin/env python
import ConfigParser
import json
import os
Dirty script to get Mozilla Firefox tabs URLs on stdout
sbz / freebsd.json
Created Dec 19, 2014
FreeBSD config file (base, localbase, kernel?, ...) backup as json in order to redeploy/backup config
View freebsd.json
"@base": {
"files": [
"make.conf": {
"filename": "make.conf",
"dirpath": "/etc/",
"@destination": "/etc/make.conf",
"@content": {
"svn_update": "yes",
sbz / auxv.c
Last active Aug 29, 2015
auxv: dump elf auxillary vector information on freebsd
View auxv.c
#include <stdio.h>
#include <elf.h>
/* /usr/include/x86/elf.h AT_* defs */
typedef struct {
const char *str_val;
int type;
} Elf_AuxStr;
sbz /
Created Apr 23, 2014
gitlab: list your groups and projects using api v3
#!/usr/bin/env python
import os
import requests
import subprocess
import sys
from pprint import pprint as pp