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
| # Run with: rackup faye.ru -s thin -E production | |
| # For executor-customer chat | |
| require "bundler/setup" | |
| require "faye" | |
| require 'redis' | |
| require 'redis/objects' | |
| Redis.current = Redis.new(:host => '127.0.0.1', :port => 6379) | |
| Faye::WebSocket.load_adapter('thin') |
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/local/ruby/bin/ruby -w | |
| Dbpath = "/data/db" # database path | |
| Backpath = "/data/dbbackup" # backup directory | |
| Host = "" # mongo host to connect,empty is for local | |
| Database = "" # database to use. empty is for all | |
| Collection = "" # collection to use | |
| User = "" | |
| Passwd = "" | |
| Now = Time.now | |
| DATE = Now.strftime("%Y-%m-%d") |
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
| Latency Comparison Numbers | |
| -------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns | |
| Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
| Read 4K randomly from SSD* 150,000 ns 0.15 ms |
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
| # in controller_name.rb : | |
| before_filter :http_auth | |
| # in application_controller.rb : | |
| def http_auth | |
| authenticate_or_request_with_http_basic do |username, password| | |
| username == "user" && password == "password" | |
| 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
| require 'ip' | |
| grammar BindConf | |
| include IP | |
| rule entries | |
| (zone / key / server)* { | |
| %w(zone key server).each do |i| | |
| module_eval <<-eot, __FILE__, __LINE__+1 | |
| def each_#{i}(&block) |
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
| .DS_Store | |
| Gemfile.lock | |
| *.pem | |
| node.json | |
| tmp/* | |
| !tmp/.gitignore |
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
| var crypto = require('crypto'); | |
| var dns = require('native-dns'); | |
| var rest = require('restler'); | |
| var server = dns.createServer(); | |
| server.on('request', function (request, response) { | |
| var domain = request.question[0].name; | |
| if(domain == 'webutils.flourishworks.com') { | |
| // Don't log this because it can't be uniquely identified and subsequently retrieved |
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
| # Simple, scrappy UDP DNS server in Ruby (with protocol annotations) | |
| # By Peter Cooper | |
| # | |
| # MIT license | |
| # | |
| # * Not advised to use in your production environment! ;-) | |
| # * Requires Ruby 1.9 | |
| # * Supports A and CNAME records | |
| # * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance | |
| # * All records get the same TTL |
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
| var crypto = require('crypto'); | |
| var dns = require('native-dns'); | |
| var rest = require('restler'); | |
| var server = dns.createServer(); | |
| server.on('request', function (request, response) { | |
| var domain = request.question[0].name; | |
| if(domain == 'webutils.flourishworks.com') { | |
| // Don't log this because it can't be uniquely identified and subsequently retrieved |
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 | |
| # Author: ashay dot humane at gmail.com | |
| # Given a file name, this script prints the file creation time, | |
| # as ext4 records it | |
| # Might error out on other filesystems | |
| DEBUGFS="/sbin/debugfs" | |
| [[ -f "$1" ]] || { echo "Invalid filename. Exiting" ; exit 1; } |