Skip to content

Instantly share code, notes, and snippets.

Bernd Zeimetz bzed

Block or report user

Report or block bzed

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bzed
bzed / haveibeenpwned.sh
Created Jan 18, 2019
haveibeenpwned password check
View haveibeenpwned.sh
#!/bin/bash
echo -n "Enter Password: "
read p
sha=`echo -n "${p}" | sha1sum - | awk '{print $1}'`
sha_short=`echo -n "${sha}" | sed 's,^\(.....\).*,\1,'`
wget -q -O - "https://api.pwnedpasswords.com/range/${sha_short}" | grep -i "${sha}"
@bzed
bzed / ssl_c_pem.lua
Created Jan 9, 2019
haproxy pem formatted ssl client cert fetch - ssl_c_pem - like ssl_c_der
View ssl_c_pem.lua
require("base64")
core.register_fetches("ssl_c_pem", function(txn)
local der = txn.f:ssl_c_der()
local wrap = ('.'):rep(64);
local envelope = "-----BEGIN %s-----\n%s\n-----END %s-----\n"
local typ = "CERTIFICATE";
der = base64.encode(data);
return string.format(envelope, typ, der:gsub(wrap, '%0\n', (#der-1)/64), typ);
@bzed
bzed / build_cura_and_slic3r.sh
Last active Oct 23, 2017
Simple script to build cura and slic3r-prusa in Debian. You need to fix the target directory.
View build_cura_and_slic3r.sh
replaced by
https://github.com/bzed/3d-printer-tools-build
View pbuilder sudoers
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
View .pbuilderrc
#!/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"
View haproxy_cpuusage_agent.socket
[Unit]
Description=HAProxy CPU usage agent
[Socket]
ListenStream=7777
ReusePort=true
Accept=true
[Install]
WantedBy=sockets.target
View haproxy_cpuusage_agent@.service
[Unit]
Description=MySQL Clustercheck for HAProxy
[Service]
StandardInput=socket
ExecStart=/usr/bin/hagent
View haproxy_agent.go
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"math"
"net"
"strconv"
@bzed
bzed / ssl_certificate_handling.make
Last active Nov 6, 2018
Makefile to handle ssl certs/intermediate files/DHs
View ssl_certificate_handling.make
#!/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
View otrs_anonymize.sql
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;
You can’t perform that action at this time.