Skip to content

Instantly share code, notes, and snippets.

Avatar

Ruben Jenster r10r

View GitHub Profile
@r10r
r10r / deadline.sh
Created Jul 8, 2020
Self terminate shell script after deadline.
View deadline.sh
#!/bin/sh
PID=$$
deadline() {
sleep $1
kill $PID
}
export deadline
deadline 2 &
@r10r
r10r / cmd_wrapper.sh
Last active Jul 6, 2020
Bash command wrapper with partial option parsing.
View cmd_wrapper.sh
#!/bin/bash
cmd=mycmd
# parse a subset of all options
while true; do
while getopts c:u:b: arg 2>/dev/null; do
case $arg in
"a")
arga=$OPTARG
;;
@r10r
r10r / cmdline_usage_syntax.md
Last active Jul 10, 2018
Cmdline Best Practises
View cmdline_usage_syntax.md

Help / Usage Syntax

Usage string format:

cmd_name [options] arg1_name [arg2_name]

  • List paths to config files and used environment variables.
  • Show links / hints for more detailed information.

Options

@r10r
r10r / golang_cheatsheet.md
Last active Dec 7, 2017
Golang Cheatsheet
View golang_cheatsheet.md

List external dependencies

go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
@r10r
r10r / vimrc.local
Last active Sep 14, 2020
My vim config file
View vimrc.local
" location of this file:
" debian: /etc/vim/vimrc.local
" custom build: /usr/local/share/vim/vimrc
" avoid that defaults overwrite custom configuration
" see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837761
" run ':scriptnames' to show the import order
let skip_defaults_vim=1
source $VIMRUNTIME/defaults.vim
@r10r
r10r / README.md
Created Aug 14, 2016 — forked from eliquious/README.md
Golang OpenPGP examples
View README.md

Building

go build -o goencrypt main.go

Generating Keys

@r10r
r10r / clearsign_test.go
Created Jul 19, 2016
Test golang OpenPGP message signing (clearsign).
View clearsign_test.go
package repository
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"fmt"
"github.com/stretchr/testify/assert"
"golang.org/x/crypto/openpgp/clearsign"
"golang.org/x/crypto/openpgp/packet"
@r10r
r10r / redmine_release_notes.tmpl.yml
Last active Jul 8, 2016
Format to export Release Notes from Redmine to YAML
View redmine_release_notes.tmpl.yml
Name: %{name}
Date: %{date}
Id: %{id}
Description: %{description}
ResolvedIssues:
-
Subject: %{subject}
ReleaseNotes: '%{release_notes}'
Id: %{id}
Tracker: %{tracker}
@r10r
r10r / find.go
Created Jun 28, 2016
Simple directory listing with include / exclude pattern support.
View find.go
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"regexp"
)
@r10r
r10r / asymmetric.go
Last active Aug 27, 2015 — forked from cryptix/asymmetric.go
example of using JWT for http authentication in go
View asymmetric.go
package main
// using asymmetric crypto/RSA keys
import (
"crypto/rsa"
"fmt"
"io/ioutil"
"log"
"net/http"
You can’t perform that action at this time.