Skip to content

Instantly share code, notes, and snippets.

View timmarinin's full-sized avatar

Tim Marinin timmarinin

View GitHub Profile
@timmarinin
timmarinin / chop.exs
Last active April 1, 2018 18:44
Guess number / PragProg Elixir 1.6
defmodule Chop do
def guess(n, range) do
mid = middle_of range
IO.puts("Is it #{mid}?")
attempt n, middle_of(range), range
end
def attempt(n, guess, _range) when n == guess do
IO.puts n
end
@timmarinin
timmarinin / graphics.md
Created August 21, 2017 10:59
`tree` cmd graphics

Простой пример:

┬
└┬/Users/mt/Workspace/src/github.com/marinintim/tree
 ├─DESIGN.md // <-- тут нужна только одна линия, продолжающаяся вниз, с отступом
 ├─README.md
 ├┬lib
 │├─draw.go // <-- здесь нужно рисовать две линии
 │├─expand.go
@timmarinin
timmarinin / ab JFK.txt
Last active July 10, 2017 23:31
airports ab output
➜ airports-list git:(master) ✗ ansible -i inventory.yml airports-ab -a 'ab -t 240 -r -s 240 -c 1000 http://airports-api.marinin.xyz/iata/JFK' -u root -f 4
188.166.47.188 | SUCCESS | rc=0 >>
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking airports-api.marinin.xyz (be patient)
Server Software:
@timmarinin
timmarinin / README.md
Last active March 17, 2017 03:45
Open source viability
function groupByUndefined(col) {
var ret = []
var current = []
for (var i = 0; i < col.length; i++) {
if (typeof col[i] !== 'undefined') current.push(col[i])
else {
ret.push(current)
current = []
}
}
function cond (a, b) {
for (let [i, x] of a.entries()) {
if (x) return b[i]
}
}
> node-proxy@0.9.0 install /home/tim/.nvm/versions/node/v4.1.0/lib/node_modules/node-proxy
> node-gyp configure build
make: Entering directory '/home/tim/.nvm/versions/node/v4.1.0/lib/node_modules/node-proxy/build'
CXX(target) Release/obj.target/nodeproxy/src/node-proxy.o
In file included from ../src/./node-proxy.h:40:0,
from ../src/node-proxy.cc:33:
../node_modules/nan/nan.h:324:27: error: redefinition of 'template<class T> v8::Local<T> Nan::imp::NanEnsureHandleOrPersistent(const v8::Local<T>&)'
NAN_INLINE v8::Local<T> NanEnsureHandleOrPersistent(const v8::Local<T> &val) {
^
0 info it worked if it ends with ok
1 verbose cli [ '/home/tim/.nvm/versions/node/v4.1.0/bin/node',
1 verbose cli '/home/tim/.nvm/versions/node/v4.1.0/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'node-proxy' ]
2 info using npm@3.3.5
3 info using node@v4.1.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
/* jshint -W079 */
var Promise = require('bluebird');
/* jshint +W079 */
@timmarinin
timmarinin / debug.log
Created September 11, 2015 20:09
debug log while npm install --save bcrypt
tim@tim-pc:~/work/logistic-web$ npm install -S bcrypt
npm WARN package.json logistic-web@1.0.0 license should be a valid SPDX license expression
/
> bcrypt@0.8.5 install /home/tim/work/logistic-web/node_modules/bcrypt
> node-gyp rebuild
gyp: /home/tim/.node-gyp/4.0.0/common.gypi not found (cwd: /home/tim/work/logistic-web/node_modules/bcrypt) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:357:16)