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
Show hidden characters
{ | |
"env": { | |
"es6": false, | |
"browser": true | |
}, | |
"parserOptions": { | |
"ecmaVersion": 5 | |
}, | |
"plugins": [], | |
"globals": { |
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 'em-websocket' | |
EM.run do | |
EM::WebSocket.run(host: '0.0.0.0', port: 8080) do |ws| | |
ws.onopen do |handshake| | |
puts 'WebSocket connection open' | |
# Access properties on the EM::WebSocket::Handshake object, e.g. | |
# path, query_string, origin, headers |
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://blog.honeybadger.io/building-a-simple-websockets-server-from-scratch-in-ruby/ | |
require 'socket' # Provides TCPServer and TCPSocket classes | |
require 'digest/sha1' | |
server = TCPServer.new('localhost', 2345) | |
loop do | |
# Wait for a connection |
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 python3 | |
'''Usage: | |
python3 http-stdout-echo.py -a <bind-address> -p <bind-port> | |
Examples: | |
python3 http-stdout-echo.py # (will listen at 127.0.0.1:8080 by default) | |
python3 http-stdout-echo.py -a 10.3.1.3 -p 5555''' | |
from http.server import HTTPServer, BaseHTTPRequestHandler |
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 python3 | |
'''Receives a command as argument and executes it on | |
every sub-folder of current folder. | |
Useful for commands that should be run multiple times, | |
like doing a git fetch on a bunch of repos. | |
Usage: ./for-each-dir.py "command" | |
Example: ./for-each-dir.py "git fetch" | |
''' |
NewerOlder