Skip to content

Instantly share code, notes, and snippets.

View qix's full-sized avatar

Josh Yudaken qix

View GitHub Profile
Date: Mon, 5 Nov 2012 11:09:20 +0200
Subject: SuperHappyDevHouse CPT on 17th November
Hi all,
We're finally running our second SuperHappyDevHouse at codebridge in
Claremont on 17th November; this time sponsored by Amazon.
It is a non-exclusive event intended for creative and curious people
interested in technology. We're about knowledge sharing, technology
exploration, and ad-hoc collaboration. Come to have fun, build things,
@qix
qix / password.py
Created November 16, 2012 15:40
One password to many using bcrypt
import bcrypt
def take(N, bignum):
mod = bignum % N
bignum = bignum / N
return (mod, bignum)
def choice(letters, bignum):
choice, bignum = take(len(letters), bignum)
return (letters[choice], bignum)
@qix
qix / password.py
Created November 16, 2012 15:52
Master password to one password per site with bcrypt algorithm
import bcrypt
def take(N, bignum):
mod = bignum % N
bignum = bignum / N
return (mod, bignum)
def choice(letters, bignum):
choice, bignum = take(len(letters), bignum)
return (letters[choice], bignum)
<?hh
function printResult($result) {
var_dump($result->vectorRowsTyped());
}
async function genMain() {
$conn = await AsyncMysqlClient::connect(
'127.0.0.1',
3306,
@qix
qix / gist:8daf3affc16c92abcddb
Created April 1, 2015 18:20
Pipelined queries
#!/usr/bin/env node
'use strict';
var mysql = require('mysql2');
var connection = mysql.createConnection({ user: 'root', database: 'memsql'});
var request = 0;
setInterval(function() {
var thisRequest = 'Request #' + (request++);
console.time(thisRequest);
mysql> SHOW LEAVES;
+---------------+------+--------------------+---------------+-----------+---------+--------------------+------------------------------+
| Host | Port | Availability_Group | Pair_Host | Pair_Port | State | Opened_Connections | Average_Roundtrip_Latency_ms |
+---------------+------+--------------------+---------------+-----------+---------+--------------------+------------------------------+
| memsql-leaf7 | 3306 | 1 | memsql-leaf8 | 3306 | online | 131 | 1.448 |
| memsql-leaf8 | 3306 | 2 | memsql-leaf7 | 3306 | offline | 1 | NULL |
| memsql-leaf9 | 3306 | 1 | memsql-leaf10 | 3306 | online | 66 | 1.205 |
| memsql-leaf10 | 3306 | 2 | memsql-leaf9 | 3306 | offline | 9 | NULL |
+---------------+------+--------------------+-------
```
root@k8s-node3:/home/josh# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.240.0.1 0.0.0.0 UG 0 0 0 eth0
10.16.4.0 0.0.0.0 255.255.255.0 U 0 0 0 docker0
10.240.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
root@consumer-statsd-tyy21:/authbox/apps/consumer-statsd# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:0a:10:04:46
```
mysql> SHOW AGGREGATORS;
+----------------+------+--------+--------------------+------------------------------+-------------------+
| Host | Port | State | Opened_Connections | Average_Roundtrip_Latency_ms | Master_Aggregator |
+----------------+------+--------+--------------------+------------------------------+-------------------+
| 127.0.0.1 | 3306 | online | 0 | NULL | 1 |
| 10.240.76.251 | 3306 | online | 2 | 1.184 | 0 |
| 10.240.194.230 | 3306 | online | 2 | 1.175 | 0 |
+----------------+------+--------+--------------------+------------------------------+-------------------+
```
ItemName: [ForeignFeature.fromFeatureGraph, 'CampaignGraph', {
outputType: 'String',
remoteFeatureName: 'ItemName',
}],
*/
// = String.fromGraphAndFeature
ItemName: ['String', 'CampaignGraph', 'Feature("ItemName")'],
@qix
qix / gist:63419f4e88d2128da105
Created May 20, 2015 00:11
Sample `query all`
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319567}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319572}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319573}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319574}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2037649}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319579}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319582}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319587}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2037660}}]
[{"timestamp":"2015-01-22T14:25:34.000Z","result":{"count":2319590}}]