Skip to content

Instantly share code, notes, and snippets.

View channprj's full-sized avatar

Heechan Park channprj

View GitHub Profile
@channprj
channprj / ghost-booting-forever
Last active January 31, 2016 13:19
Ghost blog booting script with forever package.
#!/bin/sh
### BEGIN INIT INFO
# Provides: blog
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
@channprj
channprj / daemon
Created March 3, 2016 01:31
Init script for service on RPI2
#!/bin/sh
### BEGIN INIT INFO
# Provides: my_service
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Put a short description of the service here
# Description: Put a long description of the service here
# coupang cash code
# https://coupang.saramin.co.kr/_service/coupang/apply_site/apply/recruit_default.asp
# shift operation (x >> 1) and convert to ascii character
cipher_text = ['212', '242', '214', '194', '220', '206', '128', '198', '222', '234', '224', '194', '220', '206', '92', '198', '222', '218']
def shift_operation(x):
x = int(x)
return x >> 1
for i in range(len(cipher_text)):
#!/bin/sh
### BEGIN INIT INFO
# Provides: kupy
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Jupyter init script
# Description: Jupyter init script
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
@channprj
channprj / nginx.conf
Created August 25, 2016 08:49 — forked from timmyomahony/nginx.conf
Python, UWSGI, Supervisor & Nginx
upstream uwsgi {
ip_hash;
server 127.0.0.1:40000;
}
server {
listen 80;
server_name www.domain.com;
root /sites/mysite/;
access_log /sites/mysite/log/nginx/access.log;
// ==UserScript==
// @name Bugs Music Player Black
// @namespace https://chann.kr
// @version 0.1
// @description bugs music player black theme by default
// @author CHANN
// @match http*://music.bugs.co.kr/newPlayer?*
// @grant none
// ==/UserScript==
@channprj
channprj / nginx.conf
Created October 11, 2016 05:37
Nginx configuration for Docker on Windows.
### docker run -it -p 12300:80 -p 12301:8000 -p 12302:8888 -d your/docker-image:latest zsh
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@channprj
channprj / run_cronjob_solo.sh
Last active November 2, 2016 02:49
Preventing duplicate shell script executions
#!/bin/sh
# WIP prevent duplicate cron job shell executions.
# refer: http://bencane.com/2015/09/22/preventing-duplicate-cron-job-executions/
do_function() {
# do something...
}
PIDFILE=/path/to/<YOUR_PID_FILE>.pid
if [ -f $PIDFILE ] ## if pid file exist and it is not a directory
@channprj
channprj / set.js
Last active March 8, 2017 04:08
Simple and naive implementation of array without duplicated items; Python set-like data structure written in JS. #help #wanted
var jsSet = { item: 0 }; // use Object key as set item
item = 'setItem'
if (!(item in jsSet)) { // if item not in jsSet
jsSet[item] = 1; // save item with meaningless value
}
sessionStorage.setItem('jsSet', JSON.stringify(Object.keys(usages))) // save into sessionStorage