Skip to content

Instantly share code, notes, and snippets.


Won Jun Bae wonjun27

View GitHub Profile
wonjun27 /
Created Aug 15, 2018 — forked from Fuxy22/
Bash Script functions to Manage /etc/hosts file for adding/removing hostnames.
# remove specified host from /etc/hosts
function removehost() {
if [[ "$1" ]]
if [ -n "$(grep $HOSTNAME /etc/hosts)" ]
echo "$HOSTNAME Found in your /etc/hosts, Removing now...";
sudo sed -i".bak" "/$HOSTNAME/d" /etc/hosts
wonjun27 / Dockerfile
Created May 13, 2016 — forked from yefim/
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
View Dockerfile
# Example Dockerfile
FROM hello-world
View markdown-to-pdf.txt
$ brew install markdown htmldoc
$ markdown <> | htmldoc --cont --headfootsize 8.0 --linkcolor blue --linkstyle plain --format pdf14 - > <file.pdf>
wonjun27 / bbs.js
Created Oct 14, 2015 — forked from TooTallNate/bbs.js
Running a node.js REPL over `curl`
View bbs.js
* Requires node v0.7.7 or greater.
* To connect: $ curl -sSNT. localhost:8000
var http = require('http')
, repl = require('repl')
, buf0 = new Buffer([0])
wonjun27 / repl-client.js
Created Oct 14, 2015 — forked from TooTallNate/repl-client.js
Running a "full-featured" REPL using a net.Server and net.Socket
View repl-client.js
var net = require('net')
var sock = net.connect(1337)
sock.on('connect', function () {
wonjun27 / xpub-xsub.js
Created Sep 29, 2015 — forked from tjanczuk/xpub-xsub.js
How to connect 5 publishers with 5 subscribers over TCP using ZeroMQ's XPUB/XSUB proxy
View xpub-xsub.js
// How to connect 5 publishers with 5 subscribers
// over TCP using ZeroMQ's XPUB/XSUB proxy.
// sub (connect)
// <-8701->
// (bind) xpub <---> xsub (bind)
// <-8700->
// (connect) pub
var zmq = require('zmq');
wonjun27 / FITC 2015 Toronto
Last active Oct 12, 2015
FITC 2015 Toronto
View FITC 2015 Toronto
TypeScript for Angular 2.0
Service Worker vs UI Threads
Disposable and Repeatable: Dev and Test Environments with Terraform‏
Terraform is a tool for automating and managing your physical and virtual servers, containers, DNS, and other resources. Start using it early to streamline your development and testing process, and reap the benefits as you move into production.
We’ll go through a few ways to apply the “Infrastructure as code” concept to your daily routine, and how Terraform can help you get there.
Sean Swehla
digital ocean - droplet compute team
wonjun27 /
Last active Aug 29, 2015 — forked from fideloper/
Master-Slave database in CodeIgniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//Create a new config file
| Number of databases in use
| Using a Master and Slave. The Slave doubles as a read-only database.

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$" "$extension_id%26uc" 
unzip -d "$extension_id-source" "$"

Thx to crxviewer for the magic download URL.

wonjun27 / Leaderboard Using Redis
Last active Aug 11, 2021
Leaderboard Using Redis
View Leaderboard Using Redis
Leaderboard Using Redis
Strava KOMS, Powered by Redis
For example, what if I only want to see a leaderboard of members who are between the ages of 18 and 49? The Sorted Set contains no information on how old each member is. And I don’t want to maintain a separate Redis Sorted Set for just these users, because that’s kind of redundant, right? You probably don’t want to fetch every single one of the potentially hundreds of thousands of records and filter individually… that’s not very efficient! There’s a couple of ways you could approach this with Redis. One is by way of Lua scripting with use of EVAL (which runs Lua) and ZSCAN (which can be used for matching keys and values by rules, similar to regular expressions).