Skip to content

Instantly share code, notes, and snippets.

@nirev
nirev / README.md
Created June 7, 2022 20:07 — forked from koshatul/README.md
use Apple Keychain to store GPG Passphrases

gpg-agent setup

Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)

$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *
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
@nirev
nirev / call_osascript.sh
Last active February 22, 2021 19:16
dialog notifications in OSX
# Get the logged in user's name
CURRENT_USER="$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')"
# Get information necessary to display messages in the current user's context.
USER_ID=$(id -u "$CURRENT_USER")
if [[ "$OS_MAJOR" -eq 10 && "$OS_MINOR" -le 9 ]]; then
L_ID=$(pgrep -x -u "$USER_ID" loginwindow)
L_METHOD="bsexec"
elif [[ "$OS_MAJOR" -eq 10 && "$OS_MINOR" -gt 9 ]]; then
L_ID=USER_ID
@nirev
nirev / puppeteer.js
Last active April 4, 2023 01:49
Using Proxies with Elixir and Node
function getBrowser() {
const proxyHost = process.env.PROXY_HOST;
const proxyPort = process.env.PROXY_PORT;
const proxyServer = `${proxyHost}:${proxyPort}`;
const browserlessToken = process.env.BROWSERLESS_TOKEN;
if (LOCAL_DEBUG) {
return puppeteer.launch({
headless: false,
devtools: false,

How to patch Android app to sniff its HTTPS traffic with self-signed certificate

requirements

  • apktool [1]

steps

  • Unpack apk file: apktool d app.apk
  • Modify AndroidManifest.xml by adding android:networkSecurityConfig="@xml/network_security_config" attribute to application element.
  • Create file /res/xml/network_security_config.xml with following content:
@nirev
nirev / inetrc
Created October 8, 2020 19:32
Configuring Erlang inet
%% -- ERLANG INET CONFIGURATION FILE --
%% https://erlang.org/doc/apps/erts/inet_cfg.html
%% use it by setting the following envvar:
%% export ERL_INETRC="/path/to/this-file"
%%
%% read and monitor nameserver config from here
{resolv_conf, "/etc/resolv.conf"}.
%% increase cache size
{cache_size, 2000}.
%% specify lookup method
@nirev
nirev / elasticsearch.md
Created September 15, 2020 13:06
Elasticsearch Data Streams
@nirev
nirev / caching_docker_images.md
Created August 14, 2020 16:34
Caching docker images

Speeding up Docker builds in CI

Every time a build starts in a new agent, the docker build cache is empty, and thus a docker build will need to rebuild the entire image from scratch.

To avoid this we can repopulate the docker cache when starting a build.

Without docker multi stage

If your build is not using multi-stage yet, re-populating the cache is easier.

@nirev
nirev / Dockerfile
Created September 30, 2019 16:30
Elixir Dockerfile based on erlang
ARG OTP_VERSION=22.0
##################################################
# Base - setup project and docker cache for build
FROM erlang:${OTP_VERSION}-alpine as base
# elixir expects utf8.
ENV ELIXIR_VERSION="v1.9.1" \
LANG=C.UTF-8
@nirev
nirev / Dockerfile
Last active June 30, 2020 14:03
Elixir docker deployment
ARG OTP_VERSION=22.0
##################################################
# Base - setup project and docker cache for build
FROM erlang:${OTP_VERSION}-alpine as base
# elixir expects utf8.
ENV ELIXIR_VERSION="v1.9.1" \
LANG=C.UTF-8