This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Install virtualbox: | |
| # - http://www.virtualbox.org/wiki/Downloads | |
| # - Download iso: http://releases.ubuntu.com/10.10/ | |
| # - Create a new virtualbox using the iso as the install media | |
| # - Change network adapter to bridged | |
| # - Use ifconfig to get ip address | |
| # | |
| # Once you have a clean install of ubuntu... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html | |
| # https://www.varnish-cache.org/trac/wiki/VCLExamples | |
| # Summary | |
| # 1. Varnish will poll the backend at /health_check to make sure it is | |
| # healthy. If the backend goes down, varnish will server stale content | |
| # from the cache for up to 1 hour. | |
| # 2. Varnish will pass X-Forwarded-For headers through to the backend | |
| # 3. Varnish will remove cookies from urls that match static content file | |
| # extensions (jpg, gif, ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ProgressBar | |
| def initialize(units=60) | |
| @units = units.to_f | |
| end | |
| def print(completed, total) | |
| norm = 1.0 / (total / @units) | |
| progress = (completed * norm).ceil | |
| pending = @units - progress | |
| Kernel.print "[#{'=' * progress }#{' ' * ( pending )}] #{percentage(completed, total)}%\r" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.run ($rootScope, $filter, $log) -> | |
| $rootScope.$on( '$stateChangeStart', (ev, to, toParams, from, fromParams) -> | |
| $log.info('state change from ', from.name, $filter('json')(fromParams), ' to ', to.name, $filter('json')(toParams)) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'thread' | |
| # Usage ./list-files [DIRECTORY] | |
| WORKERS = 5 | |
| queue = Queue.new | |
| @results = Queue.new | |
| threads = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module MultiSplit | |
| def msplit(*delimiters) | |
| return [ self ] if delimiters.empty? | |
| if idx = index( delimiters.first ) | |
| [ self[ 0...idx ] ] + self[ ( idx + delimiters.first.length )..-1 ].msplit( *delimiters ) | |
| else | |
| msplit( *delimiters[1..-1] ) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| web: bundle exec ruby app.rb -sv -e prod -p $PORT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [color] | |
| branch = auto | |
| diff = auto | |
| status = auto | |
| [color "branch"] | |
| current = yellow reverse | |
| local = yellow | |
| remote = green |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it "has a nice api" do | |
| # To set the video bitrate of the output file to 64kbit/s: | |
| # ffmpeg -i input.avi -b:v 64k output.avi | |
| builder = FastForward.build do |ff| | |
| ff.input "input.avi" | |
| ff.output "output.avi" do |o| | |
| o.bitrate("64k").stream("video") | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class UI | |
| container: null | |
| events: { } | |
| constructor: () -> | |
| this.bindEvents() | |
| bindEvents: () -> | |
| for event_type_and_selector, callback of @events | |
| [event_type, selector] = event_type_and_selector.split(' ') |
NewerOlder