Skip to content

Instantly share code, notes, and snippets.

Avatar
🤯
learning many things

David Asabina vidbina

🤯
learning many things
View GitHub Profile
@vidbina
vidbina / msg_to_dead_actor.py
Created Sep 4, 2017
Playing w/ DeadLetter and ChildActorExited msgs
View msg_to_dead_actor.py
import time
from datetime import timedelta
from thespian.actors import *
# The thing is that a A1 is only truly the parent of A2 if it spawns A2.
# In the former implementation A1 and A2 were all spawned by the application
# root node and as such only reported their exit status to that node.
@vidbina
vidbina / virtualbox.nix
Created Jul 22, 2017
VirtualBox on NixOS with Extension Pack
View virtualbox.nix
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
virtualbox
];
virtualisation.virtualbox.host.enable = true;
nixpkgs.config.virtualbox.enableExtensionPack = true;
@vidbina
vidbina / zap.zsh
Created Mar 4, 2016
Call `zap` in a terminal of interest. Go to another terminal and call `splat` to load all the environment variables as known in the terminal from which `zap` was called. Open another terminal and call `teleport` to go to the directory from which `zap` was called.
View zap.zsh
#!/bin/zsh
# Since I keep opening new windows and cd-ing into the right places or
# exporting the needed variables, I figured it would make a lot of sense
# to have some code do this for me... It's simply: zap, splat, teleport!
function zap() {
# make a snapshot of whatever matters at this moment :)
echo $PWD > "/tmp/zap.pwd"
echo "⚡️"
printenv > "/tmp/zap.env"
}
@vidbina
vidbina / gpg-helpers.sh
Created Nov 23, 2014
gpg-agent-helpers
View gpg-helpers.sh
#!/bin/sh
# The current agent term is managed through the TTY_SET_FILE which only
# contains the name of the term currently responsible for handling all gpg
# UI stuff.
# Prior to setting up a term to function as the front-end to GPG-Agent one
# needs to get the agent started first
# The tty currently active as GPG-Agent front-end
@vidbina
vidbina / dns.mx.json
Created Oct 14, 2014
Amazon Route53 JSON config file examples
View dns.mx.json
{
"Comment": "Setting up my mailserver records for Google Mail",
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "example.com.",
"Type": "MX",
"TTL": 300,
"ResourceRecords": [
@vidbina
vidbina / .phpbrew-php-version-helper.sh
Last active Aug 29, 2015
helper to load the right PHP version as specified in the .php-version file with phpbrew
View .phpbrew-php-version-helper.sh
# This helper will switch the PHP version using phpbrew provided that there is a .php-version present
# Call this helper by calling it with the source command: source FILENAME
# NOTE: You do need to install the proper version yourself in order for this to work (phpbrew install VERSION)
if [ -f .php-version ]
then
VERSION=$(<.php-version)
printf "Loading PHP v$VERSION\n"
phpbrew use $VERSION
else
printf "A .php-version containing the version is needed\n\n"
@vidbina
vidbina / phpenv-install-releases.log
Created May 31, 2014
debug output of ```phpenv install --releases &> phpenv-install-releases.log```
View phpenv-install-releases.log
+ [phpenv:33] '[' -z '' ']'
+ [phpenv:34] PHPENV_ROOT=/Users/anon/.phpenv
+ [phpenv:38] export PHPENV_ROOT
+ [phpenv:40] '[' -z '' ']'
++ [phpenv:41] pwd
+ [phpenv:41] PHPENV_DIR=/Users/anon/.phpenv
+ [phpenv:50] export PHPENV_DIR
+ [phpenv:53] shopt -s nullglob
++ [phpenv:55] abs_dirname /Users/anon/.phpenv/bin/phpenv
+++ [phpenv:20] pwd
@vidbina
vidbina / gitprompt.bashrc
Last active Dec 18, 2015
The code appended to my .bashrc or my .bash_profile (OSX) to keep my prompt short and sweet.
View gitprompt.bashrc
function parse_git_rep {
git remote -v 2> /dev/null | \
sed -e '/fetch)$/!d' | \
grep "[a-zA-Z0-9_-]*/[a-zA-Z0-9_-]*\.git" -o --color=never | \
sed -e 's/.git/ /'
}
function parse_git_branch {
git branch --no-color 2> /dev/null | \
sed -e '/^[^*]/d' -e 's/* \(.*\)/î‚ \1 /'
}