Skip to content

Instantly share code, notes, and snippets.

View wonjun27's full-sized avatar
🎯
Focusing

Won Jun Bae wonjun27

🎯
Focusing
View GitHub Profile
@wonjun27
wonjun27 / aws_autoscaling_cron.rb
Last active July 27, 2021 16:59 — forked from kixorz/aws_autoscaling_cron.rb
Running cron jobs in AWS Auto Scaling group is tricky. When you deploy the same code and configuration to all instances in the group, cron job would run on all of them. You may not want that. This script detects the first instance in the group and allows only this instance to run the job. IAM user used by this script needs to have permissions to…
#!/usr/bin/env ruby
require 'syslog'
require 'net/http'
require 'aws-sdk'
Syslog.open
AWS.config({
:access_key_id => '<iam user key>',
:secret_access_key => '<iam user secret>'
@wonjun27
wonjun27 / bash_aliases.sh
Created August 15, 2018 05:43 — forked from Fuxy22/bash_aliases.sh
Bash Script functions to Manage /etc/hosts file for adding/removing hostnames.
# remove specified host from /etc/hosts
function removehost() {
if [[ "$1" ]]
then
HOSTNAME=$1
if [ -n "$(grep $HOSTNAME /etc/hosts)" ]
then
echo "$HOSTNAME Found in your /etc/hosts, Removing now...";
sudo sed -i".bak" "/$HOSTNAME/d" /etc/hosts
@wonjun27
wonjun27 / Dockerfile
Created May 13, 2016 01:47 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@wonjun27
wonjun27 / markdown-to-pdf.txt
Created October 24, 2015 15:17 — forked from davisford/markdown-to-pdf.txt
Convert Markdown to PDF
$ brew install markdown htmldoc
$ markdown <file.md> | htmldoc --cont --headfootsize 8.0 --linkcolor blue --linkstyle plain --format pdf14 - > <file.pdf>
@wonjun27
wonjun27 / bbs.js
Created October 14, 2015 12:43 — forked from TooTallNate/bbs.js
Running a node.js REPL over `curl`
/**
* 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
wonjun27 / repl-client.js
Created October 14, 2015 12:40 — forked from TooTallNate/repl-client.js
Running a "full-featured" REPL using a net.Server and net.Socket
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)
@wonjun27
wonjun27 / xpub-xsub.js
Created September 29, 2015 00:28 — forked from tjanczuk/xpub-xsub.js
How to connect 5 publishers with 5 subscribers over TCP using ZeroMQ's XPUB/XSUB proxy
// 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');
<?php
session_start();
include_once "google-api-php-client/examples/templates/base.php";
/************************************************
Make an API request authenticated with a service
account.
************************************************/
require_once realpath(dirname(__FILE__) . '/google-api-php-client/src/Google/autoload.php');
<?php
// WARNING: right now, support for redis-cluster is experimental,
// unoptimized and in its very early stages of development. To
// play with it you must have a correct setup of redis-cluster
// running (oh hai mr. obvious) and Predis v0.7-dev fetched from
// the redis_cluster branch of the Git repository.
require 'autoload.php';
{
"folders": [{
"follow_symlinks": true,
"path": "."
}],
"settings": {
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"tab_size": 2,
"file_exclude_patterns": [