This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RegionCodeISO31662ToFIPS = map[string]string{ | |
// From Maxmind's list. | |
"AD-2": "02", | |
"AD-3": "03", | |
"AD-4": "04", | |
"AD-5": "05", | |
"AD-6": "06", | |
"AD-7": "07", | |
"AD-8": "08", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AD": "ca", | |
"AE": "ar-AE,fa,en,hi,ur", | |
"AF": "fa-AF,ps,uz-AF,tk", | |
"AG": "en-AG", | |
"AI": "en-AI", | |
"AL": "sq,el", | |
"AM": "hy", | |
"AN": "nl-AN,en,es", | |
"AO": "pt-AO", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Code.ensure_loaded?(Ecto.Type) do | |
defmodule Bitstring do | |
@moduledoc """ | |
Implements the Ecto.Type behaviour for the Postgres | |
type "bit varying" | |
""" | |
use Ecto.Type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/ | |
set -e | |
history1=$1 | |
history2=$2 | |
merged=$3 | |
echo "Merging history files: $history1 + $history2" | |
test ! -f $history1 && echo "File $history1 not found" && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# References: | |
# | |
# https://cinhtau.net/2016/12/09/disable-apt-auto-update-and-upgrade/ | |
# https://unix.stackexchange.com/questions/315502/how-to-disable-apt-daily-service-on-ubuntu-cloud-vm-image | |
# https://askubuntu.com/questions/824718/ubuntu-16-04-unattended-upgrades-runs-at-random-times/831206 | |
apt-get -y purge update-notifier-common ubuntu-release-upgrader-core landscape-common unattended-upgrades | |
systemctl kill --kill-who=all apt-daily.service | |
systemctl kill --kill-who=all apt-daily-upgrade.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Helper commands for clouformation deploy in the EC2 instances | |
# curl http://169.254.169.254/latest/user-data | |
# cat /var/log/cloud-init-output.log | |
# sudo yum install htop tmux tcpdump telnet -y | |
# describe stack | |
# this parameters are not passed by command line parameters | |
# to ensure that the developer does not hit a different STACK NAME or template by mistake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Originally from: http://erlang.org/pipermail/erlang-questions/2017-August/093170.html | |
For a safe and fast Erlang SSL server, there's a few | |
configuration values you might want by default: | |
[{ciphers, CipherList}, % see below | |
{honor_cipher_order, true}, % pick the server-defined order of ciphers | |
{secure_renegotiate, true}, % prevent renegotiation hijacks | |
{client_renegotiation, false}, % prevent clients DoSing w/ renegs | |
{versions, ['tlsv1.2', 'tlsv1.1']}, % add tlsv1 if you must |
Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'
Example: To get json record having _id equal 611
cat my.json | jq -c '.[] | select( ._id | contains(611))'
Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dash_id=xxxx | |
api_key=xxx | |
app_key=xxx | |
# 1. export | |
curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json | |
# 2. edit dash.json | |
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level |
NewerOlder