Skip to content

Instantly share code, notes, and snippets.

View hijaq's full-sized avatar

Alex Smirnov hijaq

  • Toronto, Canada
View GitHub Profile
const { commandFactory: CommandFactory } = require('hystrixjs');
/**
* Initializes and returns a circuit breaker
* @param {function} fn Function to execute
* @param {object} opts Hystrix options
* @property {number} opts.timeout Timeout for request
* @property {function} opts.errorHandler Function to validate if the error response from the service is an actual error
* @property {function} opts.fallbackTo Function, which will be executed if the request fails. The function will be called with the error as the 1st argument and an array of the original args as the 2nd argument
* @property {number} opts.circuitBreakerSleepWindowInMilliseconds How long the circuit breaker should stay opened, before allowing a single request to test the health of the service
@hijaq
hijaq / macos-reset-dns.sh
Last active August 31, 2017 21:12
Reset MacOS X dns cache
#!/bin/sh
sudo killall -HUP mDNSResponder
sudo killall mDNSResponderHelper
sudo dscacheutil -flushcache
@hijaq
hijaq / compare.sh
Last active August 28, 2016 18:43
Compare content of two folders recursively
#!/bin/sh
# Compare content of two folders recursively, without MacOS X specific files and ignore attributes/user/group
rsync --dry-run --no-perms --no-owner --no-group --no-times --exclude=.DS_Store --exclude=._* -v -r -c <source> <destination>
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
#
# Update 2013-06-24: added -w0 option to prevent truncated lines
require 'base64'
data=`ioreg -l -w0 -d0 -r -c AppleDisplay`