Skip to content

Instantly share code, notes, and snippets.

View axelabs's full-sized avatar

AXE Labs axelabs

View GitHub Profile
@axelabs
axelabs / gist:51ebce97ddbd8f9ab475
Created March 19, 2015 15:30
Unblocking EventMachine's deferred callbacks [output]
[2015-03-19 10:26:00 -0500] I'm a blocking worker, I'll be done in 2 secs
[2015-03-19 10:26:01 -0500] .
[2015-03-19 10:26:02 -0500] .
[2015-03-19 10:26:02 -0500] worker done!
[2015-03-19 10:26:02 -0500] I'm a blocking callback, I'll be done in 4 secs
[2015-03-19 10:26:06 -0500] callback done!
[2015-03-19 10:26:06 -0500] .
[2015-03-19 10:26:07 -0500] I'm a blocking worker, I'll be done in 2 secs
[2015-03-19 10:26:07 -0500] .
[2015-03-19 10:26:08 -0500] .
@axelabs
axelabs / em-dc-unblock.rb
Created March 19, 2015 15:34
Unblocking EventMachine's deferred callbacks
#!/usr/bin/ruby
# Example of how to unblock EventMachine's deffered callbacks
# Based on http://stackoverflow.com/a/11778588/632827
# For output example see: http://goo.gl/d6E9E0
require 'eventmachine'
iam = [ 'blocking', 'non-blocking' ]
@axelabs
axelabs / .screenrc
Created November 10, 2015 14:55
Screen Config
startup_message off
term screen-256color
setenv LC_CTYPE en_US.UTF-8
defutf8 on
setenv DISPLAY ':0'
nonblock on
vbell off
defscrollback 5000
backtick 1 60 60 $HOME/Scripts/batstat
@axelabs
axelabs / .bashrc
Created November 10, 2015 14:59
Bash eternal history and autocomplete
# Bash history settings
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
# ssh host autocomp
@axelabs
axelabs / gist:13d797b812285974f8aeeedc221c1736
Created January 30, 2017 16:43
Vagrant scp error on windows
me@win10desktop MINGW64 ~/Vagrant/centos7
$ vagrant.exe scp /c/Users/me/Downloads/file.zip :/tmp/
The machine with the name 'C' was not found configured for
this Vagrant environment.
@axelabs
axelabs / expAws.sh
Last active July 28, 2023 00:45
Export selected AWS profile into environments 🐚
# Usage from POSIX shell: . ./expAws.sh
PROFILES=$(awk configure list-profiles)
select PROFILE in $PROFILES; do
export AWS_ACCESS_KEY_ID="$(aws configure get aws_access_key_id --profile $PROFILE)"
export AWS_SECRET_ACCESS_KEY="$(aws configure get aws_secret_access_key --profile $PROFILE)"
export AWS_DEFAULT_REGION="$(aws configure get region --profile $PROFILE)"
export AWS_SESSION_TOKEN="$(aws configure get aws_session_token --profile $PROFILE)"
export AWS_SECURITY_TOKEN="$(aws configure get aws_security_token --profile $PROFILE)"