Skip to content

Instantly share code, notes, and snippets.

View dolmen's full-sized avatar
😁
Happy!

Olivier Mengué dolmen

😁
Happy!
View GitHub Profile
@mojzu
mojzu / README.md
Created January 5, 2022 20:20
MTLS with Caddy and step-ca

Example docker compose file

version: "3"
services:
  caddy:
    build:
      context: .
      dockerfile: service/caddy/dockerfile
    image: mojzu/dev-caddy:latest
@dolmen
dolmen / jsonl
Created July 3, 2018 16:13
Transform a JSON input containing a single array into the "JSON Lines" format
#!/usr/local/bin/jq -cf
# This script transforms a JSON input containing a single array into the "JSON Lines" format (http://jsonlines.org)
# See https://stackoverflow.com/questions/42178636/how-to-use-jq-to-output-jsonl-one-independent-json-object-per-line
#
# Install:
# - save this file as "jsonl"
# - install jq (https://stedolan.github.io/jq/)
# - chmod u+rx jsonl
#
@hadrianw
hadrianw / gdb-strace.sh
Last active June 14, 2018 12:10
strace with backtrace thanks to gdb
#!/bin/sh
cmd=$1
shift
# FIXME: it would be good for every argument to be wrapped in quotes
echo run $@ | gdb "$cmd" -x strace.gdb &> gdb-strace-log
@jdarpinian
jdarpinian / executable.c
Last active May 30, 2024 19:42
Add one line to your C/C++ source to make it executable.
///$(which true);FLAGS="-g -Wall -Wextra --std=c17 -O1 -fsanitize=address,undefined";THIS_FILE="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")";OUT_FILE="/tmp/build-cache/$THIS_FILE";mkdir -p "$(dirname "$OUT_FILE")";test "$THIS_FILE" -ot "$OUT_FILE" || $(which clang || which gcc) $FLAGS "$THIS_FILE" -o "$OUT_FILE" || exit $?;exec bash -c "exec -a \"$0\" \"$OUT_FILE\" $([ $# -eq 0 ] || printf ' "%s"' "$@")"
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
@subfuzion
subfuzion / dep.md
Last active July 25, 2024 03:38
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@hexvolt
hexvolt / .bashrc
Last active October 12, 2016 09:33
Aliases for .bashrc to find Raspberry. Note: MAC addresses of adaptors are there
alias find-pi-wifi="sudo nmap -sP 192.168.1.0/24 | awk '/^Nmap/{ip=\$NF}/00:E0:4D/{print ip}'"
alias find-pi="sudo nmap -sP 10.50.0.0/24 | awk '/^Nmap/{ip=\$NF}/B8:27:EB/{print ip}'"
@jcefoli
jcefoli / SaveSpotlightImages.ps1
Last active December 30, 2023 18:34
Copies the Windows Spotlight lock screen images in Windows 10 to a "Windows Spotlight" folder in My Pictures.
<#
.DESCRIPTION
Copies the Windows Spotlight lock screen images in Windows 10 to a "Windows Spotlight" folder in My Pictures.
This script will intelligently sort through the temporary directory and will only copy images
that are 1920x1080. Since the filenames of the images can change, the script will also compare
SHA1 hashes of the existing so we don't copy duplicates.
.NOTES
Version: 1.0.2
#!/usr/bin/env perl
# Copyright 2015 by David Golden
# Licensed under CC0 https://creativecommons.org/publicdomain/zero/1.0/
# Updated 2016-03-01:
# - more variation in organzations selected; you will want to customize this yourself
# - splits out wishlists differently/correctly
# - reports only PRs unless --all is specified
use v5.10;
use strict;
use warnings;
@loisaidasam
loisaidasam / README.md
Last active October 19, 2023 16:07
Sort git tags by semver

If you're like me and you use semver for versioning your tags, you probably hate when you do this:

$ git tag -l
0.1.0
0.10.0
0.2.0
0.3.0
0.3.1
0.4.0

0.5.0

#!/usr/bin/env perl
use strict;
use warnings;
sub dep(@) { Dep->new( name => @_ ) }
## Archive::Tar ------
dep 'GSAR/Archive-Tar-0.071.tar.gz' => provides => { 'Archive::Tar' => '0.071', };
dep 'SRZ/Archive-Tar-0.22.tar.gz' => provides => { 'Archive::Tar' => '0.22', };