Skip to content

Instantly share code, notes, and snippets.

View geek's full-sized avatar
🏠
Working from home

Wyatt Preul geek

🏠
Working from home
View GitHub Profile
@geek
geek / isvalid.sh
Last active June 15, 2017 23:12
Compare registry entry for module vs website
#!/bin/bash
# Example usage
# cat modules | while LINE='$\n' read -r LINE; do ./valid.sh $LINE; done;
MODULE=$1
if [ -z "$MODULE" ]; then
MODULE=$(tee);
fi
SITE=$(curl -s https://www.npmjs.com/package/${MODULE} | pup 'body > div.container.content > div.sidebar > ul:nth-child(3) > li:nth-child(2) > strong text{}')
@geek
geek / prom
Last active May 19, 2017 21:14
# HELP http_requests_total The total number of HTTP requests.
# TYPE http_requests_total counter
http_requests_total{method="post",code="200"} 1027 1395066363000
http_requests_total{method="post",code="400"} 3 1395066363000
# Escaping in label values:
msdos_file_access_time_seconds{path="C:\\DIR\\FILE.TXT",error="Cannot find file:\n\"FILE.TXT\""} 1.458255915e9
# Minimalistic line:
metric_without_timestamp_and_labels 12.47
@geek
geek / mule.js
Last active November 5, 2016 21:57
Demonstrating Mule inheritance in JavaScript
'use strict';
function Mule (obj, ...args) {
const mule = new Proxy({}, {
get: function (target, prop, receiver) {
const topKeys = Object.keys(target);
if (topKeys.includes(prop)) {
return target[prop];
}
until curl https://github.com/nodejs/node/releases/tag/v5.0.0 -f -s; do sleep 60; done; open http://imagesmtv-a.akamaihd.net/uri/mgid:file:http:shared:mtv.com/news/wp-content/uploads/2015/06/yas-gif-1435361093.gif
@geek
geek / seneca-mem.md
Last active January 6, 2016 16:20
mem leak investigation
PID COMMAND %CPU TIME #PORTS MEM
35084 node 2.2 19:55.75 29 73M+

service source

'use strict';
@geek
geek / actions.js
Created December 2, 2015 21:00
attempt to pull out actions
/* Copyright (c) 2010-2015 Richard Rodger, MIT License */
'use strict'
var _ = require('lodash')
var Jsonic = require('jsonic')
var Common = require('./common')
var internals = {}
`.,:;:,``
,'''''''''''';`
`;''''''''''''''''',
;'''''''''''''''''''.
.'''''''''''''''''''';
;'
@geek
geek / micro-benchmark.md
Last active September 24, 2015 02:50
JSON.parse vs jsonic

Code

var jsonic = require('jsonic')
var input = '{ "foo": "bar", "red": 1 }'

exports.compare = {
  'jsonic': function () {
    jsonic(input)
 },
@geek
geek / why.js
Created September 9, 2015 09:33
var Http = require('http');
var Fs = require('fs');
var Url = require('url');
var server = Http.createServer(function (req, res) {
res.writeHead(200);
res.end();
});