Skip to content

Instantly share code, notes, and snippets.

View chwnam's full-sized avatar

Changwoo Nam chwnam

View GitHub Profile
@chwnam
chwnam / Sewol 304 Curves.nb
Created April 16, 2018 06:24
304개의 곡선으로 구성된 세월호 리본 (원본출처: http://bit.ly/2HDcOrC, https://goo.gl/khXLb8)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 0, 0]
NotebookDataLength[ 63161, 1511]
NotebookOptionsPosition[ 57778, 1418]
NotebookOutlinePosition[ 58164, 1435]
CellTagsIndexPosition[ 58121, 1432]
WindowFrame->Normal*)
@chwnam
chwnam / drobox_attachments.py
Last active January 15, 2019 14:09
드롭박스 공개 공유 URL로부터 모든 하위 폴더에 위치한 파일의 조사, aria2c 프로그램으로 다운로드 받을 수 있도록 인자를 만들어 내는 스크립트입니다.
# /usr/bin/env python2
# -*- coding: utf-8 -*-
import argparse
import csv
import json
import os
import sys
import dropbox
@chwnam
chwnam / rrmdir.php
Created May 30, 2017 01:08
Recursively remove a directory
<?php
header('Content-Type: text/plain');
function rrmdir($dir)
{
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
@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);
@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 / 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);
#!/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 / 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
@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 / 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