(Migrated from jdrydn/dotfiles)
A simple script to allow me to have multiple SSH server listings without clouding up my SSH config.
Example usage:
$ cd /path/to/a/working/directory
(Migrated from jdrydn/dotfiles)
A simple script to allow me to have multiple SSH server listings without clouding up my SSH config.
Example usage:
$ cd /path/to/a/working/directory
if (require('cluster').isMaster) { | |
const cluster = require('cluster'); | |
const CPU = require('os').cpus(); | |
const LIMIT = process.env.LIMIT || CPU.length; | |
const start = Date.now(); | |
// Generate a list of MAX numbers to loop through | |
const LIST = (new Array(parseInt(process.env.MAX || 10, 10))).fill(null).map((v, k) => k + 1); |
I hereby claim:
To claim this, I am signing this object:
module.exports = function scanEach(redis, opts, eachFn, callback) { | |
var scan_args = [ opts.cursor || 0 ]; | |
if (opts.prefix) scan_args.push('MATCH', opts.prefix); | |
if (opts.count) scan_args.push('COUNT', opts.count); | |
scan_args.push(function (err, results) { | |
if (err) return callback(err); | |
if (!Array.isArray(results)) return callback(new Error('Invalid results from redis SCAN command')); |
-- Usage: HINCRALLBY AKeyOfYourChoice 1 | |
-- HKEYS AKeyOfYourChoice | |
-- HINCRBY AKeyOfYourChoice KEY 1 | |
-- Not sure on performance or what would happen with a hash of 100,000 keys | |
-- And I don't really want to find out! | |
local keys = redis.call("HKEYS", ARGV[1]) | |
local results = {} | |
for i,k in ipairs(keys) do results[i] = redis.call("HINCRBY", ARGV[1], keys[i], ARGV[2]) end | |
return results |
A simple proxy service that takes requests and send them to specific ports based on their hostname.
Nothing special at all & extremely helpful once upon a time ago.
Uses http-proxy and forever.
<?php | |
$query = 'SELECT id, column1, column2, column3 FROM ImportantTable WHERE something LIKE "SomethingElse%";'; | |
exec("mysql -h 123.456.789.012 -u SomeImportantUser -p'P4ssw0rd!' BigImportantDatabase -e '$query' | sed 's/\t/,/g' > ".__DIR__."/output.csv"); | |
$mail = new stdClass; | |
$mail->to = "james@jdrydn.com"; | |
$mail->subject = "CSV Output for that query you asked for"; | |
$mail->hash = md5(uniqid()); | |
$mail->headers = array( |