Skip to content

Instantly share code, notes, and snippets.

View yunghoy's full-sized avatar

Youngho Lee yunghoy

  • Vancouver, Canada
View GitHub Profile
@yunghoy
yunghoy / gist:65e845c8c6b3f7ed847fce03cb8e584f
Created September 7, 2016 16:42
moving to await/async
var Promise = require('bluebird');
var redis = Promise.promisifyAll(require('redis'));
var redis = require('bluebird').promisifyAll(require('redis'));
http://stackoverflow.com/questions/38841204/events-js160-throw-er-unhandled-error-event
---
events.js:160
throw er; // Unhandled 'error' event
^
Error: Channel closed by server: 404 (NOT-FOUND) with message "NOT_FOUND - no exchange 'exchange_name_final' in vhost '/'"
at Channel.C.accept (/home/nilath/test/rabbitmq/node_modules/amqplib/lib/channel.js:406:17)
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
// application specific logging, throwing an error, or other logic here
});
process.on('uncaughtException', function (err) {
console.error('Unhandled Rejection at:', err.stack);
// application specific logging, throwing an error, or other logic here
console.log('NODE will not be terminated.');
});
@yunghoy
yunghoy / color1.sh
Created November 2, 2016 15:08
shell color #1
# console.log("\x1b[36m sometext \x1b[0m");
# console.log("\x1b[31m sometext \x1b[0m");
# console.log("\033[31m\033[40m sometext \033[0m");
# console.log("\x1b[31m\x1b[40m sometext \x1b[0m");
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
@yunghoy
yunghoy / color2.sh
Created November 2, 2016 15:09
shell color #2
#!/bin/bash
#
# generates an 8 bit color table (256 colors) for
# reference purposes, using the \033[48;5;${val}m
# ANSI CSI+SGR (see "ANSI Code" on Wikipedia)
#
echo -en "\n + "
for i in {0..35}; do
printf "%2b " $i
done
I believe you can connect gdb to a running valgrind process, and instruct it to run a leak check explicitly.
I haven't tried this, just seen it in the docs.
In case of link breakage:
Connecting GDB to a Valgrind gdbserver
$ valgrind --tool=memcheck --vgdb=yes --vgdb-error=0 ./prog
(the error parameter is the number of errors before the gdbserver becomes active: zero means it starts running right away).
#sudo apt-get install ia32-libs
ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 ~/.local/share/Steam/ubuntu12_32/libGL.so.1
#!/bin/bash
CONTAINER=${STREAM}_${ISLAND_NAME}_1
CONTAINER_ID=$(docker ps -a | grep ${CONTAINER} | awk '{print $1}')
# exception check if the container exists
if [ ! ${CONTAINER_ID} ]; then
echo "There is no ${CONTAINER}"
exit 1
fi
user nobody nogroup;
worker_processes auto; # auto-detect number of logical CPU cores
events {
worker_connections 1024; # set the max number of simultaneous connections (per worker process)
}
http {
##
// haproxy
global
log /dev/log local0
listen http
log /dev/log local0
mode http
capture request header Referer len 128
capture request header User-Agent len 128
log-format |%si:%sp|%ci:%cp|%t|%ID|%s|%ST|%B|\"%r\"|\"%hr\"|