Skip to content

Instantly share code, notes, and snippets.

View jamesmoriarty's full-sized avatar
🔮
0xc0000005

James Moriarty jamesmoriarty

🔮
0xc0000005
View GitHub Profile
@jamesmoriarty
jamesmoriarty / build-aws.sh
Last active December 4, 2017 03:05
docker-compose build \w --build-args
REGEX='^ [^ :]\{1,\}'
PROXY=''
grep -o -i $REGEX docker-compose.yml \
| xargs \
docker-compose build \
--build-arg http_proxy=$PROXY \
--build-arg NPM_ARGS='--proxy http://$PROXY --https-proxy http://$PROXY --strict-ssl false' \
$@
@jamesmoriarty
jamesmoriarty / index.ts
Last active November 9, 2017 02:03
express-graphql, request-promise, graphql-tools, resolvers
import * as express from 'express';
import * as request from 'request-promise';
import * as graphqlHTTP from 'express-graphql';
import { makeExecutableSchema } from 'graphql-tools';
const typeDefs = `
type V2 {
origin: String
title: String
}
import { exec } from 'child_process';
exec(`{ echo "GET hello"; sleep 0.05; } | telnet 127.0.0.1 6379`, (error, stdout, stderr) => {
// assert
});
@jamesmoriarty
jamesmoriarty / redis.js
Created October 26, 2017 04:46
ioredis fragment compression
var Redis = require('ioredis');
const zlib = require('zlib');
Redis.Command.setArgumentTransformer('set', (args) => {
const value = args[1];
switch (typeof value){
case 'string':
args[1] = zlib.gzipSync(value).toString('base64');
require "minitest/autorun"
class Proxy
module DSL
module ClassMethods
def option(name)
define_method(name) do |value|
tap do
options[name] = value
end
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R
bind | split-window -h
bind - split-window -v
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
@jamesmoriarty
jamesmoriarty / query.rb
Last active April 29, 2016 19:30
Newrelic Insights Query
require 'net/http'
require 'uri'
require 'json'
module NewRelic
module Insights
class Query
attr_reader :key, :account_id
def initialize(key, account_id)
1. go to http://dl.hhvm.com/ubuntu/pool/main/h/hhvm/ and right click and copy the link to the version of hhvm you want to rollback to
2. sudo apt-get autoremove hhvm -y
3. wget <link you just copied>
4. sudo dpkg -i <name of file u just downloaded>
5. apt-get install -f
6. service hhvm start
Edit: Don't worry when it errors out on step 4. that is expected. just continue to step 5.
### Keybase proof
I hereby claim:
* I am jamesmoriarty on github.
* I am jamesmoriarty (https://keybase.io/jamesmoriarty) on keybase.
* I have a public key whose fingerprint is 06A1 9318 4CA2 F3A0 BDA4 1B17 0062 ED6D CBAF BEEF
To claim this, I am signing this object:
#!/usr/bin/env ruby
#
# Syncs Ruby binstubs for ruby-communal-gems.
# Run this everytime you install a new Ruby, or when you install a new gem
# with a bin/ command. (ie, when you typically do rbenv rehash)
#
# See: https://github.com/tpope/rbenv-communal-gems/issues/5
#
require 'fileutils'