Skip to content

Instantly share code, notes, and snippets.

View bzed's full-sized avatar
🇺🇦
❤️ 🇩🇪 🇦🇹

Bernd Zeimetz bzed

🇺🇦
❤️ 🇩🇪 🇦🇹
View GitHub Profile
BEGIN;
create schema if not exists random;
create temp table word_copy(word TEXT);
COPY word_copy from '/usr/share/dict/ngerman' ENCODING 'UTF8';
create table random.words(id BIGSERIAL PRIMARY KEY, word TEXT);
insert into random.words(word) SELECT word from word_copy;
@bzed
bzed / ssl_certificate_handling.make
Last active November 6, 2018 16:13
Makefile to handle ssl certs/intermediate files/DHs
#!/usr/bin/make -f
CRTS := $(wildcard *.crt)
PEMS := $(shell echo $(CRTS) | sed 's,\.crt,.pem,g')
OCSPS := $(shell echo $(CRTS) | sed 's,\.crt,.ocsp,g')
DHS := $(shell echo $(CRTS) | sed 's,\.crt,.dh,g')
all: $(PEMS) $(OCSPS) $(DHS)
chmod 600 *.key
@bzed
bzed / pfsense.grok
Created March 10, 2015 22:23
Logstash pfsense pattern
# GROK match pattern for logstash.conf filter: %{PFSENSE_LOG_DATA}%{PFSENSE_IP_SPECIFIC_DATA}%{PFSENSE_IP_DATA}%{PFSENSE_PROTOCOL_DATA}
# GROK Custom Patterns (add to patterns directory and reference in GROK filter for pfSense events):
# GROK Patterns for pfSense 2.2 Logging Format
#
# Created 27 Jan 2015 by J. Pisano (Handles TCP, UDP, and ICMP log entries)
# Edited 14 Feb 2015 by E. Paul
# Edited 10 Mar 2015 by Bernd Zeimetz <bernd@bzed.de>
# taken from https://gist.github.com/elijahpaul/f5f32d4e914dcb7fedd2
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"math"
"net"
"strconv"
@bzed
bzed / build_cura_and_slic3r.sh
Last active October 23, 2017 08:21
Simple script to build cura and slic3r-prusa in Debian. You need to fix the target directory.
replaced by
https://github.com/bzed/3d-printer-tools-build
Cmnd_Alias PBUILDER = /usr/sbin/pbuilder,/usr/sbin/cowbuilder,/usr/bin/linux32 /usr/sbin/cowbuilder
Defaults!PBUILDER env_keep+=HOME
Defaults!PBUILDER env_keep+=ARCH
Defaults!PBUILDER env_keep+=DIST
Defaults!PBUILDER env_keep+=CUSTOM
Defaults!PBUILDER env_keep+=HOOKDIR
$user ALL=(ALL) NOPASSWD: SETENV: PBUILDER
#!/bin/bash
# Idea stolen at https://wiki.ubuntu.com/PbuilderHowto
# Enhanced to support experimental, backports and oldstable.
# Does not build with non-free by default anymore.
# DIST NONFREE ARCH CUSTOM should be added to env_keep in your sudoers config.
OLDOLDSTABLE="squeeze"
OLDSTABLE="wheezy"
OLDSTABLE_ARCHIVED="false"
[Unit]
Description=HAProxy CPU usage agent
[Socket]
ListenStream=7777
ReusePort=true
Accept=true
[Install]
WantedBy=sockets.target
[Unit]
Description=MySQL Clustercheck for HAProxy
[Service]
StandardInput=socket
ExecStart=/usr/bin/hagent
create schema if not exists random;
create temp table word_copy(word TEXT);
COPY word_copy from '/usr/share/dict/ngerman' ENCODING 'UTF8';
create table random.words(id BIGSERIAL PRIMARY KEY, word TEXT);
insert into random.words(word) SELECT word from word_copy;
create or replace function random.random_ids(