If you are like many (most?) of us, you have encountered Rails
Credentials/Secrets and secret_key_base
and may have been
left a bit (or more) confused.
This post is an attempt to remove some of that confusion by
Public Domain |
# When you need to process a hash with keys in sorted order | |
# you may have found the `sort()` function - but it only | |
# operates on an Array. | |
# | |
# Most of the time what is wanted is simply achieved | |
# by taking the keys of a hash and sorting those and | |
# then iterating over the keys. | |
# | |
# When, however the wanted result is a new Hash | |
# with all keys sorted recursively then this becomes |
### No longer needed as of nginx-1.13.6-1.el7_4.ngx.x86_64.rpm from nginx.org | |
### it was compiled against OpenSSL 1.0.2 from CentoOS 7.4 so it supports ALPN (HTTP2 works) | |
yum -y groupinstall 'Development Tools' | |
yum -y install wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel rpmdevtools | |
OPENSSL="openssl-1.0.2l" | |
NGINX_VERSION="1.13.5-1" | |
NJS_VERSION="1.13.5.0.1.13-1" |
Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message
Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.
Create an empty commit-msg git hook file, and make it executable. From your project's root directory:
install -b -m 755 /dev/null .git/hooks/commit-msg
Save the following script to the newly-created .git/hooks/commit-msg file:
WARNING: If you're reading this in 2021 or later, you're likely better served by reading:
(This gist was created in 2013 and targeted the legacy GOPATH mode.)
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
#!/usr/bin/env bash | |
# This script prints out all of your Redis keys and their size in a human readable format | |
# Copyright 2013 Brent O'Connor | |
# License: http://www.apache.org/licenses/LICENSE-2.0 | |
human_size() { | |
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
} |
-- gets all fields from a hash as a dictionary | |
local hgetall = function (key) | |
local bulk = redis.call('HGETALL', key) | |
local result = {} | |
local nextkey | |
for i, v in ipairs(bulk) do | |
if i % 2 == 1 then | |
nextkey = v | |
else | |
result[nextkey] = v |
This playbook has been removed as it is now very outdated. |