Skip to content

Instantly share code, notes, and snippets.

View vidbina's full-sized avatar
😪
M-x parental-mode

David Asabina vidbina

😪
M-x parental-mode
View GitHub Profile
@vidbina
vidbina / phpenv-install-releases.log
Created May 31, 2014 15:59
debug output of ```phpenv install --releases &> 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 / .phpbrew-php-version-helper.sh
Last active August 29, 2015 14:02
helper to load the right PHP version as specified in the .php-version file with phpbrew
# 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 / dns.mx.json
Created October 14, 2014 09:40
Amazon Route53 JSON config file examples
{
"Comment": "Setting up my mailserver records for Google Mail",
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "example.com.",
"Type": "MX",
"TTL": 300,
"ResourceRecords": [
@vidbina
vidbina / gpg-helpers.sh
Created November 23, 2014 09:44
gpg-agent-helpers
#!/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 / gitprompt.bashrc
Last active December 18, 2015 13:49
The code appended to my .bashrc or my .bash_profile (OSX) to keep my prompt short and sweet.
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 /'
}
@vidbina
vidbina / zap.zsh
Created March 4, 2016 22:26
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.
#!/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 / msg_to_dead_actor.py
Created September 4, 2017 16:53
Playing w/ DeadLetter and ChildActorExited msgs
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 July 22, 2017 07:57
VirtualBox on NixOS with Extension Pack
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
virtualbox
];
virtualisation.virtualbox.host.enable = true;
nixpkgs.config.virtualbox.enableExtensionPack = true;