Skip to content

Instantly share code, notes, and snippets.

View ryanprior's full-sized avatar

Ryan Prior ryanprior

View GitHub Profile
@ryanprior
ryanprior / gix
Created September 30, 2021 22:32
#!/usr/bin/env bash
set -eu
[[ -f requirements.txt || -f Pipfile ]] && python="python-" || python=""
[[ $python == "" && -f Gemfile ]] && ruby="ruby-" || ruby=""
pkg="$1"
shift
def animal_song (farm)
result = farm.keys.reduce(
{ verses: [] of Array(String), words: [] of String }
) do |result, animal|
verse = [] of String << "old mac had farm, on it #{animal}" << "with #{farm[animal]}"
verse << "here #{farm[animal]}" if result[:words].empty?
verse.concat(result[:words].reverse)
{
verses: result[:verses] << verse,
words: result[:words] << "and #{farm[animal]}"
@ryanprior
ryanprior / magit-diff-colors.el
Created November 20, 2020 19:45
Tropical high-contrast colors for Magit diffs
;; removed code is orchid on warm violet
(set-face-attribute 'magit-diff-removed nil :background "#2d1523" :foreground "#be749f")
(set-face-attribute 'magit-diff-removed-highlight nil :background "#4c243b" :foreground "#dbb3ca")
;; added code is banana cream on cool dusty violet
(set-face-attribute 'magit-diff-added nil :background "#291f2e" :foreground "#f5cf75")
(set-face-attribute 'magit-diff-added-highlight nil :background "#2c1f33" :foreground "#f7d991")
@ryanprior
ryanprior / *shell*
Created October 4, 2020 14:32
Links on esbuild package
$ ldd /gnu/store/rxkh9bdfg6rpqm2sxm22npq4sd5yyvlc-go-github-com-evanw-esbuild-0.7.9/bin/esbuild
linux-vdso.so.1 (0x00007ffccab9e000)
libgcc_s.so.1 => /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/libgcc_s.so.1 (0x00007f2934dc8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f293499d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f29345ac000)
/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f2934bbc000)
@ryanprior
ryanprior / gist:7a991aabf28f153802b28761c556c7fa
Created November 27, 2019 21:17
example: tar with gzip vs plain tar
ryan@swallowtail:~/.emacs.d$ time tar czf elpa.tar.gz elpa
real 0m3.048s
user 0m3.056s
sys 0m0.197s
ryan@swallowtail:~/.emacs.d$ time tar cf elpa.tar elpa
real 0m0.189s
user 0m0.028s
sys 0m0.155s
input = ARGV.first unless ARGV.empty?
ARGV.shift unless ARGV.empty?
program = %(
input = "#{input}"
#{ARGV.join " "}
)
Process.exec("/usr/bin/python3", ["-c", program])
# -*-mode:sh-*-
function py-cli {
(
export PYCLI_INPUT="$1"
shift
read -r -d ~~ program <<EOF
from os import environ
input = environ['PYCLI_INPUT']
$@
~~

The Three Best Software Community Chat Options for 2019

For an online community built around software, the best chat options are Gitter, Zulip, and Matrix. I'll start with some traits they all share, then break out into strengths of each.

Gitter, Zulip and Matrix/riot.im are:

  • excellent: they do the job with practically no drawbacks
  • accessible: they make it easy for people to join your community
  • free software

Setting up Conjur with just docker and bash

Many of our demos require docker-compose and a compose file, plus maybe a startup script to get started with Conjur. That's convenient because it gives great reproducibility, and I personally like docker-compose a lot, but in this gist I want to show off how to get a Conjur server up and running with only docker and bash, nothing more.

This was performed on my dev machine running macOS 10.13.5, with Docker version 18.03.1-ce and GNU bash, version 3.2.57.

Conjur Authenticators vs authn-local

A Comparison:

Authenticators authn-local
audience end-users Conjur developers/integrators
purpose authenticate a user or host create an auth token
access exposed externally via an API exposed inside the container via a UNIX socket
restrictions imposed by the design (eg ldap authenticator can only auth ldap users) none