Skip to content

Instantly share code, notes, and snippets.

View chwnam's full-sized avatar

Changwoo Nam chwnam

View GitHub Profile
@chwnam
chwnam / imbc_stop
Created October 2, 2015 03:29
동작 중인 mplayer 중지시키는 명령
!#/bin/bash
pgrep mplayer | xargs kill
<?php
/**
* Plugin Name: Read Only Custom Post
* Description: Sample code of read-only custom post
* Author: changwoo
* Author URI: mailto://[email protected]
*/
add_action( 'init', 'rocp_register_post_type' );
function rocp_register_post_type() {
@chwnam
chwnam / build_predix_seed
Last active July 15, 2016 19:13
predix-seed automation shell script.
#!/bin/bash
## Automatic predix-seed generation script
## 2016-07-15 Changwoo Nam ([email protected])
## predix-seed: https://github.com/PredixDev/predix-seed
## EDIT THESE VARIABLES
predix_seed_name="pangyo_predix_seed"
uaa_service_name="pangyo_uaa_instance"
@chwnam
chwnam / disable_pad_when_mouse_found
Last active August 1, 2016 02:26
Detect mouse is attached, and disable touchpad
#!/bin/bash
~/bin/touchpad detect-mouse
detected=$?
if [[ $detected -eq 0 ]]; then
~/bin/touchpad off
else
~/bin/touchpad on
fi
@chwnam
chwnam / hangul.py
Created November 6, 2016 11:34
멈뭄미의 저주
# -*- coding: utf-8 -*-
def separate(ch):
unicode_index = ord(ch) - 0xac00
final = unicode_index % 28
temp = (unicode_index - final) // 28
initial, medial = temp // 21, temp % 21
return initial, medial, final
@chwnam
chwnam / imbc_table
Last active December 2, 2016 07:57
MBC 라디오 프로그램 정보
Version: 20161202
75800000,imbc,mfm,00:00,푸른밤 종현입니다,bluenight,FM4U000001140
75800200,imbc,mfm,02:00,미쓰라의 야간개장,openingnight,FM4U000001281
75800300,imbc,mfm,03:00,이주연의 영화음악,music_street_11,FM4U000001180
75800400,imbc,mfm,04:00,비포 선라이즈 허일후입니다,beforesunrise2,FM4U000001276
75800500,imbc,mfm,05:00,세상을 여는 아침 이재은입니다,worldmorning,FM4U000001000
75800700,imbc,mfm,07:00,굿모닝 FM 노홍철입니다,morningfm,RAMFM240
75800900,imbc,mfm,09:00,오늘 아침 정지영입니다,todaym,FM4U000001070
75801100,imbc,mfm,11:00,이루마의 골든디스크,goldendisc,RAMFM260
75801200,imbc,mfm,12:00,정오의 희망곡 김신영입니다,musicparty,FM4U000001226
#!/bin/bash
PWD=`pwd`
PROJ=`basename $PWD`
VENV_DIR="/home/changwoo/.virtualenvs/$PROJ"
if [[ -d $VENV_DIR ]]; then
echo $PWD > "$VENV_DIR/.project"
echo ".project added to $VENV_DIR"
fi
@chwnam
chwnam / wphook47.php
Created January 22, 2017 17:47
WP_Hook 실험
<?php
/**
* Plugin Name: WPHook47
* Description: WP_Hook 을 사용한 4.7 버전과 그 이전의 버전은 이 코드를 실행하면 결과가 다릅니다.
*/
add_action( 'wp_footer', function() {
error_log( '---------------' );
add_action( 'wph47_test01', 'wph47_test01', 10);
@chwnam
chwnam / hook-dump-master.php
Last active February 19, 2017 05:15
워드프레스의 모든 훅을 덤프해서 표로 만드는 플러그인입니다. 워드프레스 플러그인 강의 #2 강사용 플러그인입니다.
<?php
/*
Plugin Name: hookdump-master
Description: hookdump example by master. Use it under WP4.7+
Author: changwoo
*/
if( !function_exists( 'dump_all_hooks' ) ) {
function dump_all_hooks() {
global $wp_filter;
@chwnam
chwnam / chmod.php
Created May 30, 2017 00:53
CHMOD recursively.
<?php
header('Content-Type: text/plain');
/**
* Changes permissions on files and directories within $dir and dives recursively
* into found subdirectories.
*/
function chmod_r($dir, $dirPermissions, $filePermissions) {
$dp = opendir($dir);