Skip to content

Instantly share code, notes, and snippets.

View gyaresu's full-sized avatar

Gareth gyaresu

View GitHub Profile
@gyaresu
gyaresu / gist:1848acc320e4c441d995
Last active August 29, 2015 14:21
Nodeschool Vancouver 2015-07-25

Dear NodeSchoolers,

Hi!

I'm { Gareth: https://twitter.com/gyaresu }

I'll be one of the mentors helping out on International NodeBots day and I must say, I'm REALLY EXCITED!

Teaching is the best way to learn, and I love hanging out with people who are brave enough to learn new things. So thanks!

@gyaresu
gyaresu / gist:8ec65881ef162bf879ec
Created May 23, 2015 22:23
How to catch a stream error (using through2)
var tr = require('through2')
function write(buffer, encoding, next) {
try {
this.push(buffer.toUpperCase()) //buffer needs .toString()
} catch (e) {
this.emit('error', e)
}
next()
}
@gyaresu
gyaresu / solution.js
Last active August 29, 2015 14:22
Why won't yield return from within a `.map` callback? - stackoverflow
// https://stackoverflow.com/questions/30498103/why-wont-yield-return-from-within-a-map-callback/30498924#30498924
// WARNING: UNTESTED!
function *mapGen (arr,callback) {
for (var i=0; i<arr.length; i++) {
yield callback(arr[i])
}
}
Array.prototype.mapGen = mapGen;
@gyaresu
gyaresu / look-sync-do-async.js
Last active August 29, 2015 14:22
LOOK SYNC, DO ASYNC - learn-generators
// My code comments for just the example code (no spoilers) from: Learn Generators: Look Sync, Do Async
// https://github.com/isRuslan/learn-generators/blob/master/exercises/look_sync_do_async/problem.md
var fs = require('fs')
function run (generator) {
var it = generator(go) //[go]
console.log(1, go, it) // 1 [Function: go] { _invoke: [Function: invoke] }
function go (err, result) {
console.log(3, result, '< result') // [3]
@gyaresu
gyaresu / brew.txt
Created May 30, 2015 08:26
brew list
ack hicolor-icon-theme pdf-redact-tools
atk htop-osx pixman
autoconf hub pkg-config
automake icu4c portaudio
bash iftop postgresql
boost imagemagick privoxy
brew-cask ipcalc py2cairo
c-ares isl pygobject
cairo jbig2dec pygtk
cloog jpeg pyqt
@gyaresu
gyaresu / logs
Created June 13, 2015 08:52
docker logs -f 6b8651dc71f0
⇒ docker logs -f 6b8651dc71f0
/usr/lib/python2.7/dist-packages/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2015-06-13 08:42:26,231 CRIT Supervisor running as root (no user in config file)
2015-06-13 08:42:26,231 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2015-06-13 08:42:26,260 INFO RPC interface 'supervisor' initialized
2015-06-13 08:42:26,260 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2015-06-13 08:42:26,260 INFO supervisord started with pid 1
2015-06-13 08:42:27,266 INFO spawned: 'nginx' with pid 8
2015-06-13 08:42:27,267 INFO spawned: 'hhvm-fastcgi' with pid 9
@gyaresu
gyaresu / docker-ps
Created June 13, 2015 08:53
docker ps -a
⇒ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6b8651dc71f0 phpstack_front:latest "/usr/bin/supervisor 8 minutes ago Up 8 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:9000->9000/tcp phpstack_front_1
608a2a5aa3b1 tutum/redis:latest "/run.sh" 8 minutes ago Up 8 minutes 0.0.0.0:6379->6379/tcp phpstack_redis_1
d89afe7cc679 tutum/mongodb:latest "/run.sh" 8 minutes ago Up 8 minutes 0.0.0.0:27017->27017/tcp, 0.0.0.0:28017->28017/tcp phpstack_mongodb_1
0d41489a5a5a tutum/mysql:latest "/run.sh" 8 minutes ago Up 8 minutes 0.0.0.0:3306->3306/tcp phpstack_mysql_1
680e2f60aed2 tutum/elasticsearch:latest "/run.sh"
@gyaresu
gyaresu / php5-fpm
Created June 13, 2015 08:56
php5-fpm
PHP logo
PHP Version 5.5.9-1ubuntu4.9
System Linux 6b8651dc71f0 4.0.3-boot2docker #1 SMP Wed May 13 20:54:49 UTC 2015 x86_64
Build Date Apr 17 2015 11:43:17
Server API FPM/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php5/fpm
Loaded Configuration File /etc/php5/fpm/php.ini
@gyaresu
gyaresu / fire-alarm.js
Created July 5, 2015 20:28
Fire Alarm
var five = require('johnny-five')
var board = five.Board()
board.on('ready', function () {
var temp = new five.Temperature({
controller: 'TMP36',
pin: 'A0'
})
var piezo = new five.Piezo(9)
var led = new five.Led(13)
┌─────────────────────────┐
│ │
│ Licence: │███
│ If it breaks │███
│ you get to keep │███
│ both pieces. │███
│ │███
│ Gareth │███
│ 2015-07-08 │███
│ │███