Skip to content

Instantly share code, notes, and snippets.

@perpetual-hydrofoil
perpetual-hydrofoil / parallel.js
Last active October 9, 2018 15:22 — forked from paul/parallel.js
fixed typo in $.each statement. (otherwise each url will be a numeral: 0,1,2..)
var results = {};
var requests = 0;
var urls = ["values/1", "values/2", "values/3"];
$.each(urls, function(idx, url) {
$.getJSON(url, function(data) {
results[url] = data.value;
++requests;
On the last machine in the chain:
nc -l 1234 | pigz -d | tar xvf -
On each intermediate machine, you use a fifo to copy the data to the next machine as well as decompressing.
mkfifo myfifo
nc $NEXT_SERVER 1234 <myfifo &
nc -l 1234 | tee myfifo | pigz -d | tar xvf -
/*
* Copyright (C) 2006, 2008 Valery Kholodkov
* Client body reception code Copyright (c) 2002-2007 Igor Sysoev
* Temporary file name generation code Copyright (c) 2002-2007 Igor Sysoev
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <nginx.h>
#!/bin/env python
from smtpd import SMTPChannel, SMTPServer
import asyncore
class LMTPChannel(SMTPChannel):
# LMTP "LHLO" command is routed to the SMTP/ESMTP command
def smtp_LHLO(self, arg):
self.smtp_HELO(arg)

Hyx.less

Hyx is a very powerful and easy to use grid system for less. Think of it like the missing half brother of Jeet.

Features

  • Flexible gutter size: you can change it whenever you want and your grid won't break.
  • Keeps your DOM clean; hyx.less will not fill your HTML with a bunch of classes.
  • Powerful and semantic syntax, .cols(1/3); means one column of three.
  • Use only what you need when you need it. This is a tool to build a grid ad-hoc to your needs. You are not stuck with a rigid API or only one way to build your grid.
// Don't forget to run the shell
// google-chrome --remote-debugging-port=9222
var url = 'http://localhost:9000/';
function startswith(str, prefix) {
return str.substring(0, prefix.length) === prefix;
}
var Chrome = require('chrome-remote-interface');
Follow these steps
============
1) Create a folder on local disk Eg: C:\Users\keerthip\Documents\Dropbox
2) Create a Drive Letter Mapping eg:(H:) to the folder path in windows with following command
subst H: C:\Users\keerthip\Documents\Dropbox
3) Install Dropbox desktop software in advanced Mode.
Select the new local drive H: and sync either selective folders or all folder to local drive ( which is original folder path)
4) Wait till content is fully synced from web account
5) Pause Syncing and Exit Dropbox
6) Delete local folder drive mapping with following command
#! /usr/bin/env python
#
# http://instagram-engineering.tumblr.com/post/12202313862/storing-hundreds-of-millions-of-simple-key-value
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
@perpetual-hydrofoil
perpetual-hydrofoil / gist:3bb699a7bd066364e535
Last active August 29, 2015 14:27 — forked from squioc/gist:3078803
conversion between iso8601 date format and unix epoch datetime
from datetime import datetime
import calendar
def epoch_to_iso8601(timestamp):
"""
epoch_to_iso8601 - convert the unix epoch time into a iso8601 formatted date
>>> epoch_to_iso8601(1341866722)
'2012-07-09T22:45:22'
"""
@perpetual-hydrofoil
perpetual-hydrofoil / redisdns.py
Created October 9, 2015 11:30 — forked from wheresalice/redisdns.py
Python DNS server with Redis backend
# A naive dns server with a Redis backend
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1)
# Tip: Use Redis's ttl functions to have temporary names
# Currently only does A records, feel free to fix that
#
# Licensed under the PSF License
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/
# Author: @Kaerast <alice@kaerast.info>
import socket