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 'socket' | |
require 'timeout' | |
def is_port_open?(ip, port) | |
begin | |
Timeout::timeout(1) do | |
begin | |
s = TCPSocket.new(ip, port) | |
s.close | |
return true |
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
# Usage: | |
# Source this script from your Bash start-up script (eg. ~/.bashrc, ~/.bash_profile) (or ~/.zshrc if using zsh, etc.). | |
# | |
# Setting titles: | |
# title something | |
# title "more than 1 word" | |
# | |
# Setting tab colors: | |
# tab_color 195 89 76 | |
# tab_color 219 154 88 |
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
{ | |
"default_line_ending": "unix", | |
"detect_indentation": true, | |
"ensure_newline_at_eof_on_save": true, | |
"rulers": | |
[ | |
80 | |
], | |
"scroll_past_end": true, | |
"tab_size": 2, |
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 net = require('net'), | |
io = require('socket.io').listen(8888); | |
io.sockets.on('connection', function (web_socket) { | |
var mud_socket = net.connect(4321, function() { // localhost is assumed | |
// client connected | |
web_socket.on('input', function(input_data) { | |
mud_socket.write(input_data); | |
}); |
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
succeedAsync = (ms, cb) -> | |
setTimeout -> | |
console.log 'succeeding: ' + ms | |
cb null, 'success: ' + ms | |
, ms | |
failAsync = (ms, cb) -> | |
setTimeout -> | |
console.log 'failing: ' + ms | |
cb 'fail: ' + 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
{ | |
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Bright.tmTheme", | |
"default_line_ending": "unix", | |
"detect_indentation": true, | |
"font_face": "Source Code Pro", | |
"font_size": 15.0, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], |
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
# Regular | |
blk='\[\e[0;30m\]' # Black - Regular | |
red='\[\e[0;31m\]' # Red | |
grn='\[\e[0;32m\]' # Green | |
ylw='\[\e[0;33m\]' # Yellow | |
blu='\[\e[0;34m\]' # Blue | |
pur='\[\e[0;35m\]' # Purple | |
cyn='\[\e[0;36m\]' # Cyan | |
wht='\[\e[0;37m\]' # White |
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
http = require 'http' | |
options = | |
host: 'api.twitter.com' | |
path: "/1/statuses/user_timeline/#{$iobjstr}.json?count=1&include_rts=1" | |
http.get options, (response) -> | |
output = [] | |
response.on 'data', (chunk) -> | |
output.push chunk |
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
db = require './db' | |
objects = new db.Collection | |
objects.addIndex {id: db.UNIQUE} | |
objects.addIndex {type: db.INDEX} | |
objects.insert {id: 1, name: 'foo' type: 'thing'} | |
objects.insert {id: 2, name: 'bar' type: 'thing'} | |
objects.insert {id: 3, name: 'baz' type: 'animal'} |
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
soundData = 'SUQzAwAAAAAAEFRDT04AAAAGAAAAT3RoZXL/+pDAv8oAABVeLuYZKgACvhglw7WgAfBYg33wCvAG/wgQAuPAxwAJgfwFB4Eo4DQH/AzIcL5hb8AUU/8A6oBIWAMIEKAmH//ACTgHSwJAACgYtgFAn/+AMcAKgBfcLnA1WOM3///ELhq8d4rcd5cE7ltD///0iPFxkoGIBBgarHG4euK5////+JwFxjljJnyAFQMSDsNwvuM4MgFkYbf/////////mwncWeKXGUFkHiaFwF8LTBjyTEAx8DIClBjx3mIoHKAhHc0yBJlLQdGhx9RUFCQ5eGDDBhREMEAkSNpCRlnyQIYDJARpFRhA5hxBlhoZbKh4xgkQkig6CiY0NOjlMKsGZZtEo7GEUkCuBpSvAyB5ZhmkRs2ps1IY7GT5kxhii4lTMoEW+ZMiYkaYkmPLyVeJa0ArXn+M2jKxIBKiJEChLchQEUCTDjyI4FhhIPLbITSIeJAQEvTUeSkjRdRChsDAV3F4Em3kYnflE4HqEJsJxYlVAIPERQZkNiARDBEZADDwsEphZdItKcIHNgoyAWbkqazjJzO+4HUB3xn/+pLATywXg9VkwS4N50mCwRflwd3pMcECSzPjMpk51kgQ4A2MyAM6EgAudpBxMjCgEgRkcTVAYZMSVFCZztxikBlwZlz5gjANNAIUCgw6FNghLLGDAGjTGDOjYkLAlYUrS1hEAdRMl9QMaRdBAVMFc4NIGXFOeyV+X5QoGg4EDu23yFS5Ejy+8Ntaa24qdMrnYd4YlhODgmT/MYgEMy2mO8oOEmFMTQzMOBqMbDEAy6aEzGmFBjqCOkRlA4JQoynl5DHzIyZfMERAIIAQhBQKIhUIPQ4xBwErQIRYxsYM3gDMQA5ZsN+cDACkyo8250MHiIINBzHiwIPBhc9KUADy5RkQachcdE4VBEgweDgkGXVbUv4FAKVjY3cdt7U+2RIvM6tkoGQqQac0idU1V2uRvVWy9uc801FRJhV |
NewerOlder