Skip to content

Instantly share code, notes, and snippets.

View theand's full-sized avatar

Heesang Chae theand

  • South Korea
View GitHub Profile
@theand
theand / make_jpg_file_list.py
Created May 10, 2014 10:28
get jpg file list and make link html
#!/home/bin/python
import os
import os.path
def getJpgList(aDir):
list = os.listdir(aDir)
jpg_list = []
for each in list:
if each.count('.') == 2:
@theand
theand / bpm.py
Created May 10, 2014 10:23
manually count bpm of a music
cnt= raw_input("input period :")
n=cnt.count('.')
print str(n) + " phases in 1 minute : " + str(n*8) + "bpm"
print str(n) + " phases in 30 seconds : " + str(n*8*2) + "bpm"
raw_input("done")
@theand
theand / whiteboardCleanser.sh
Created May 10, 2014 10:21
whiteboard image cleanser. fork of someone else's code.
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
@theand
theand / get_full_length.js
Last active August 25, 2017 04:40
jquery one-liner to get sum of each length from dom
//suppose we have bunch of dom elements like below
//<span class="length">29 minutes</span>
//method 1 - map, filter, reduce
(
$.map($('.length'), e => parseInt($(e).text(), 10))
.filter(Boolean)
.reduce( (a, b) => a + b)
) / 60;
@theand
theand / tubebox.py
Created May 7, 2014 11:24
rename ios tubebox's cached video filename accorting to each youtube's title
import sqlite3
import string
import unicodedata
import os.path
import os
########
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
def removeDisallowedFilenameChars(filename):
@theand
theand / take_bmp.py
Created March 1, 2014 15:40
walks into subdirectory, and take all .bmp files to upper directory.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import os.path
import shutil
for dirpath, dirnames, filenames in os.walk('.'):
for filename in filenames:
if filename == "extract.py" or filename.startswith('.'):
@theand
theand / rename_dot_to_underbar.sh
Created March 1, 2014 15:37
replace all occurrence of dot(.) in filenames of current directory to underbar(_). Especially to use with dotfiles.
#!/bin/bash
for i in .*
do
if [ "$i" = "." ] || [ "$i" = ".." ]
then
continue
fi
j=`echo $i | sed 's/\./_/g'`
mv "$i" "$j"
done
@theand
theand / php_to_asp.py
Created February 21, 2014 16:18
rename .php to .asp recursively. (used at 2008.08.26)
# -*- coding: cp949 -*-
import os
import stat
def FindFilesByExt(ext, path):
if path[-1] != os.sep:
path += os.sep
ext = ext.lower()
@theand
theand / mkdirs.py
Created February 21, 2014 16:16
make numbered directory (used at 2008.06.18)
import os
max = raw_input("how many?")
if max == None:
max=21
for i in range(1,int(max)+1):
os.mkdir("%02d"%i)
@theand
theand / uninstall_malware.bat
Last active August 29, 2015 13:56
Uninstall every known garbage-ware (this scripts is got from a community board)
"%APPDATA%\RapidGet\RPGUnist.exe"
"%PROGRAMFILES%\1410002\unins000.exe"
"%PROGRAMFILES%\365boan\uninst_365boan.exe"
"%PROGRAMFILES%\4shared.com\UNWISE.exe"
"%PROGRAMFILES%\4shared Desktop\uninstall.exe"
"%PROGRAMFILES%\µ¿Å°È£Å×\uninstall.exe"
"%PROGRAMFILES%\µðÆË¸Å´ÏÀúV3\unins000.exe"
"%PROGRAMFILES%\»çÀÌÆ® ¹Ù·Î°¡±â\uninst.exe"
"%PROGRAMFILES%\½º¸¶Æ®Æª\uninst.exe"
"%PROGRAMFILES%\11STshoppingIcon\uninstall.exe"