Skip to content

Instantly share code, notes, and snippets.

View yunghoy's full-sized avatar

Youngho Lee yunghoy

  • Vancouver, Canada
View GitHub Profile
#!/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
#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
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).
@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
@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
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.');
});
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)
@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'));
@yunghoy
yunghoy / gist:a425f91824d26461bb2e3653bc56ebbf
Last active June 2, 2022 00:34
AMQP library (RabbitMQ) - async/await
alias babel-node='babel-node --presets stage-0'
------ RECV ------
// babel-node recv2.js "#"
// babel-node recv2.js "kern.*"
const amqp = require('amqplib');
const args = process.argv.slice(2);
if (args.length == 0) {
// Code for checking the behavior of Consul
var Promise = require('bluebird');
var Consul = require('consul');
var consul = Consul({host: "localhost", promisify: true});
// Session Create
consul.session.create({
name: "test-java-script",
ttl: "600s",