Skip to content

Instantly share code, notes, and snippets.

@robrich
robrich / gist:74bff4b51358a3470160
Created May 1, 2014 17:35
Experiments on request timeouts when a server isn't listening in different platforms
/*jshint node:true */
'use strict';
/*
What happens if there's no server listening when we do the request?
- win32: socket.on('timeout' fires and req.abort() fires req.on('error', e) with e.code === 'ECONNRESET'
- else: req.on('error', e) fires imediately with e.code === 'ECONNREFUSED'
*/
var http = require('http');
@robrich
robrich / phxjs-gulpfile.js
Created June 19, 2014 03:57
sample gulpfile.js created at @phxjs
//jshint node:true
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var uglify = require('gulp-uglify');
var gulpIf = require('gulp-if');
var express = require('express');
@robrich
robrich / hammerhead-from-lrx21o-to-lrx22c.md
Last active August 29, 2015 14:12 — forked from eyecatchup/hammerhead-from-lrx21o-to-lrx22c.md
@jonmcoe is right: it's trivial to get into recovery mode from the stock recovery
  UPDATE `NEXUS 5` 
     SET `VERSION`='5.0.1', `BUILD`='LRX22C', `RECOVERY`='CUSTOM', `ROOTED`=1 
   WHERE `VERSION`='5.0' && `BUILD`='LRX21O' && `RECOVERY`='CUSTOM' && `ROOTED`=1 
         && `WANNA_KEEP_USERDATA`=1;

A manual OTA for rooted hammerheads, quasi.

@robrich
robrich / hammerhead-from-lrx21o-to-lrx22c.md
Last active August 29, 2015 14:12 — forked from eyecatchup/hammerhead-from-lrx21o-to-lrx22c.md
@jonmcoe is right, it's trivial to get into stock recovery's options
  UPDATE `NEXUS 5` 
     SET `VERSION`='5.0.1', `BUILD`='LRX22C', `RECOVERY`='CUSTOM', `ROOTED`=1 
   WHERE `VERSION`='5.0' && `BUILD`='LRX21O' && `RECOVERY`='CUSTOM' && `ROOTED`=1 
         && `WANNA_KEEP_USERDATA`=1;

A manual OTA for rooted hammerheads, quasi.

@robrich
robrich / AuthorApi.js
Last active October 15, 2018 22:21
Move from promises to async/await
import delay from './delay';
import { authors } from './authorData'
//This would be performed on the server in a real app. Just stubbing in.
let maxid = authors.reduce(((currentMax, {id}) => currentMax>id ? currentMax : id), 0 );
const generateId = (author) => {
return ++maxid;
};
version: '2'
services:
memsql:
image: 'memsql/cluster-in-a-box'
ports:
- 3306:3306
- 8080:8080
environment:
LICENSE_KEY: ${LICENSE_KEY}
# A deployment ensures pod(s) are restarted on failure
apiVersion: apps/v1
kind: Deployment
metadata:
name: memsql
spec:
replicas: 1 # only create one pod (container)
selector:
matchLabels:
app: memsql
CREATE DATABASE hellomemsql;
USE hellomemsql;
CREATE TABLE test (
message text NOT NULL
);
INSERT INTO test (message) VALUES ('this is a sample message');
@robrich
robrich / Vagrantfile
Last active October 12, 2021 16:35
MemSQL Vagrant Dev Cluster
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu1904"
# set the provider
config.vm.provider "virtualbox"
# configure the provider
config.vm.provider "virtualbox" do |v|
v.cpus = 4
v.memory = 4096
end
@robrich
robrich / deployment.yaml
Created February 4, 2020 22:20
Kubernetes first elements
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
labels:
app: myapp
spec:
replicas: 3
template:
metadata: