Skip to content

Instantly share code, notes, and snippets.

View dmkc's full-sized avatar

Dmitry Kichenko dmkc

View GitHub Profile
@dmkc
dmkc / filesize_change_stats.rb
Last active October 30, 2020 21:04
track how quickly file size grows until Ctrl+C. follows symlinks
start_time = Time.now
files = {}
SAMPLE_INTERVAL = 2
def record_filesize(fds, sizes)
loop do
fds.each do |file|
unless sizes[file]
sizes[file] = []
end
@dmkc
dmkc / static_server.js
Created August 20, 2012 20:34 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = parseInt( process.argv[2] ) || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname,
filename = path.join(process.cwd(), uri);
@dmkc
dmkc / gist:1031883
Created June 17, 2011 17:42
A mostly RFC822 compatible email address regex that captures just the email adress. Accepts addresses like "Jimi Hendrix" <jimi@virgin.com>, John Lennon <john@ilikecatcherintherye.com>, "<cobain@shotguns.com>" <cobain@shotguns.com> and "anything &@#^" <va
(?:(?:\"[^\"]+\"|[^@,\"]+)\\s+<(?=[^>]+>))?([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4})(?:>)?