Skip to content

Instantly share code, notes, and snippets.

View yunghoy's full-sized avatar

Youngho Lee yunghoy

  • Vancouver, Canada
View GitHub Profile
Author: Yungho Yi 이영호
Date: 2. 19. 2016
Description:
To run a shell script with various commands for Jenkins, I implemented a small shell script function to parse parameters
Possible Parameter Inputs:
-a 1 3 2 4 -b 1 3 2 1 -> (-a 1 3 2 4) (-b 1 3 2 1)
132 1 -a 3 -> (-a 3)
-a 3-2 -> (-a 3-2)
-a -2 -> (-a)
symlink on host directory in virtualbox
https://www.virtualbox.org/ticket/10085#comment:27
http://stackoverflow.com/questions/29831501/docker-not-reporting-memory-usage-correctly
https://docs.docker.com/engine/installation/linux/ubuntulinux/
sudo apt-get install linux-generic-lts-vivid
@yunghoy
yunghoy / kibana
Last active March 31, 2016 17:56
scripted field examples
_source.duration.value == 0 ? -1 : (_source.duration.value/60000)
doc['duration'].value && (doc['duration'].value/60000)
doc['duration'].value == 0 ? -1 : (doc['duration'].value/60000)
doc['duration'] && (doc['duration'].value/60000)
doc['duration'].value == null ? -1 : (doc['duration'].value/60000)
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#modules-scripting
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-advanced-scripting.html
// new_task.js
#!/usr/bin/env node
var amqp = require('amqplib/callback_api');
amqp.connect('amqp://localhost', function(err, conn) {
conn.createChannel(function(err, ch) {
var q = 'task_queue';
var msg = process.argv.slice(2).join(' ') || "Hello World!";
// emit_log_direct.js
#!/usr/bin/env node
var amqp = require('amqplib/callback_api');
amqp.connect('amqp://localhost', function(err, conn) {
conn.createChannel(function(err, ch) {
var ex = 'direct_logs';
var args = process.argv.slice(2);
var msg = args.slice(1).join(' ') || 'Hello World!';
docker images | awk '{print $1} {print $2}' | paste -d':' - -
docker images | grep -v latest
@yunghoy
yunghoy / gist:e552495e55bd69024c3a3d961334811d
Created August 12, 2016 13:44
I hate a simplest job such as substituting a word for another in various files
SOURCEDIR=utils
TARGETDIR=util
pushd be > /dev/null
SERVICES="$(ls -d *-island)"
popd > /dev/null
for SERVICE in ${SERVICES}; do
pushd be/${SERVICE}/src > /dev/null
if [ -d SOURCEDIR ]; then
#!/bin/bash
SOURCEDIR=utils
TARGETDIR=util
pushd be > /dev/null
SERVICES="$(ls -d *-island)"
popd > /dev/null
for SERVICE in ${SERVICES}; do
// 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",
@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) {