Skip to content

Instantly share code, notes, and snippets.

View etam's full-sized avatar

Adam Mizerski etam

View GitHub Profile
@etam
etam / git-crypt-rm-gpg-user.sh
Last active July 21, 2023 20:03 — forked from Falkor/git-crypt-rm-gpg-user.sh
Git-crypt remove user.
#!/usr/bin/env bash
#
# Script to remove GPG user (recipient) with git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@etam
etam / yagna.json
Last active March 29, 2021 13:50
Lnav yagna format
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"yagna_log" : {
"title" : "Yagna Log Format",
"regex" : {
"basic" : {
"pattern" : "^\\[(?<timestamp>\\d{4}-\\d{2}-\\d{2}(T| )\\d{2}:\\d{2}:\\d{2}(Z|,\\d{3})) (?<level>\\w+) +(?<component>[\\w:.]+)\\] (?<body>.*)$"
}
},
"level" : {
@etam
etam / openpgp.md
Created November 1, 2020 13:47
keyoxide proof
@etam
etam / Makefile
Last active May 8, 2017 09:41
Makefile for a single binary with mixed C and C++ sources
CC := gcc
CXX := g++
CPPFLAGS :=
CFLAGS := -std=c11 -O2 -Wall -Wextra
CXXFLAGS := -std=c++14 -O2 -Wall -Wextra
LDFLAGS :=
LDLIBS := -lstdc++
COBJS :=
CXXOBJS := main.o
OBJS := $(COBJS) $(CXXOBJS)
@etam
etam / Makefile
Last active May 8, 2017 09:40
Makefile for a single c++ binary
CC := gcc
CXX := g++
CPPFLAGS :=
CXXFLAGS := -std=c++14 -O2 -Wall -Wextra
LDFLAGS :=
LDLIBS := -lstdc++
OBJS := main.o
EXE := main
all: $(EXE)
/*
primes = filterPrime [2..]
where filterPrime (p:xs) =
p : filterPrime [x | x <- xs, x `mod` p /= 0]
main = print $ take 10 primes
*/
#include <iostream>
#!/bin/bash
numeric_or_default() {
local -i val="$1"
local -i default="$2"
if [[ "$1" == "$val" ]]; then
echo "$val"
else
echo "$default"
fi
#!/bin/bash
if (( $# != 1 )); then
echo "Usage: $(basename "$0") /tmp/path/to/socket"
exit 1
fi
if [[ ! -S "$1" ]]; then
echo "$1 is not a socket"
exit 2
@etam
etam / mksum
Last active August 2, 2016 10:32
#!/bin/bash
if (( $# != 3 )); then
echo "usage: $(basename "$0") type hash filename"
exit 1
fi
type="$1"
hash="$2"
filename="$3"
#!/bin/bash
while (( $# > 0 )); do
objcopy --only-keep-debug "$1" "${1}.debug"
strip -g "$1"
objcopy --add-gnu-debuglink="${1}.debug" "$1"
shift
done