Skip to content

Instantly share code, notes, and snippets.

Francis Luong (Franco) francisluong

View GitHub Profile
View ;-)-repl.clj
user=> (def c [{:next-hop "", :prefix "", :route-status "*|e"}
#_=> {:next-hop "", :prefix nil, :route-status "*>e"}])
user=> (let [prev (atom nil)]
#_=> (map (fn [r]
#_=> (if (and @prev (not (:prefix r)))
#_=> (assoc r :prefix @prev)
#_=> (do (reset! prev (:prefix r))
francisluong / em-http-020-async-with-em-iterator.rb
Last active Jul 24, 2016
EM-HTTP-Request - Example 020 - Async Concurrency Limit using EM-Iterator
View em-http-020-async-with-em-iterator.rb
require 'eventmachine'
require 'em-http-request'
require 'logger'
require 'pry'
# concurrent requests with EM::Iterator concurrency limit of 2
FIVE = ''
TEN = ''
francisluong / em-http-010-async.rb
Last active Jul 24, 2016
EM-HTTP-Request - Example 010 - Async Concurrency
View em-http-010-async.rb
require 'eventmachine'
require 'em-http-request'
require 'logger'
require 'pry'
# concurrent requests without concurrency limits
FIVE = ''
TEN = ''
francisluong / em-http-000.rb
Last active Jul 24, 2016
EM-HTTP-Request - Example 000 - Single Request
View em-http-000.rb
require 'eventmachine'
require 'em-http-request'
require 'logger'
require 'pry'
# Single request
@start_time =
@logger =$stdout)
View http_async_multi.rb
require 'eventmachine'
require 'em-http'
require 'logger'
class HTTPAsyncMulti
@@multi = []
@@multi_done = []
@@concurrency = 2
@@logger =$stdout)
View gem build expect-behaviors.gemspec
$ gem build expect-behaviors.gemspec
WARNING: open-ended dependency on net-ssh (>= 0) is not recommended
if net-ssh is semantically versioned, use:
add_runtime_dependency 'net-ssh', '~> 0'
WARNING: open-ended dependency on codeclimate-test-reporter (>= 0, development) is not recommended
if codeclimate-test-reporter is semantically versioned, use:
add_development_dependency 'codeclimate-test-reporter', '~> 0'
WARNING: pessimistic dependency on mocha (~> 1.1.0, development) may be overly strict
if mocha is semantically versioned, use:
add_development_dependency 'mocha', '~> 1.1', '>= 1.1.0'
francisluong / DefaultKeyBinding.dict
Last active Sep 6, 2015
~/Library/KeyBindings/DefaultKeyBinding.dict - remap home and end keys in OSX
View DefaultKeyBinding.dict
// via
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
// Add to ~/Library/KeyBindings/DefaultKeyBinding.dict and restart your program.
View gist:af7ead22bd0e4fe55fe6
Nexus vlan assigned but not created
asw1-p05-0-lab# sh int eth1/17 sw
Name: Ethernet1/17
Switchport: Enabled
Switchport Monitor: Not enabled
Operational Mode: access
Access Mode VLAN: 200 (Vlan not created)
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Allowed: 1-4094
francisluong /
Created Feb 21, 2015
OSX Yosemite on VirtualBox
# Create OSX Yosemite Installer for VirtualBox using iesd gem
gem install iesd
iesd -i /Applications/Install\ OS\ X\ -o yosemite.dmg -t BaseSystem
hdiutil convert yosemite.dmg -format UDSP -o yosemite.sparseimage
ls -lh yo*
hdiutil mount /Applications/Install\ OS\ X\
hdiutil mount yosemite.sparseimage
cp /Volumes/OS\ X\ Install\ ESD/BaseSystem.* /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/OS\ X\ Install\ ESD/
francisluong / screen.lock.automator.applescript
Created Dec 15, 2014
OSX Automator Applescript to Create a Start Screensaver (Lock Screen) Hotkey
View screen.lock.automator.applescript
#Service receives *no input* in *any application*
# bind to ctrl-alt-l in keyboard shortcuts
on run {input, parameters}
tell application "System Events" to start current screen saver
return input
end run
You can’t perform that action at this time.