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.
/** | |
* A really nice way to dynamically load JavaScript files. | |
* Place this at the bottom of HTML files to load JavaScripts after pageload! :) | |
* | |
* The cake is still a lie. | |
*/ | |
(function(d, scripts){ | |
for(var id in scripts) if (d.getElementById(id) == null) { | |
var js = d.createElement('script'); js.id = id; js.src = scripts[id]; | |
d.body.appendChild(js); |
#!/bin/bash | |
# Just overriding the main SVN command | |
# So we can catch any requests to tag | |
# @javajawa++ | |
function svn | |
{ | |
case "$1" in | |
tag) | |
if [ ! -d ".svn" ]; then |
<?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 = "[email protected]"; | |
$mail->subject = "CSV Output for that query you asked for"; | |
$mail->hash = md5(uniqid()); | |
$mail->headers = array( |
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.
-- 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 |
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')); |
I hereby claim:
To claim this, I am signing this object:
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); |