Skip to content

Instantly share code, notes, and snippets.

@spikeekips
spikeekips / gist:a21582ea7035397a1650
Created March 13, 2016 04:44
open all link as a new tab
$('h3.title a').each(function() {window.open($(this).attr('href')); });
@spikeekips
spikeekips / nfc-to-nfd.py
Created April 14, 2016 03:53
NFC -> NFD
import unicodedata
nfc_string = '10 [2013010017] \xe1\x84\x89\xe1\x85\xa9\xe1\x84\x85\xe1\x85\xa7\xe1\x86\xab\xe1\x84\x8b\xe1\x85\xb4 KAL\xe1\x84\x80\xe1\x85\xb5 \xe1\x84\x80\xe1\x85\xa7\xe1\x86\xa8\xe1\x84\x8e\xe1\x85\xae\xe1\x84\x89\xe1\x85\xa1\xe1\x84\x80\xe1\x85\xa5\xe1\x86\xab 1\xe1\x84\x8c\xe1\x85\xae\xe1\x84\x82\xe1\x85\xa7\xe1\x86\xab \xe1\x84\x83\xe1\x85\xa2\xe1\x84\x8e\xe1\x85\xa2\xe1\x86\xa8 \xe1\x84\x86\xe1\x85\xb5\xe1\x86\xbe \xe1\x84\x80\xe1\x85\xa1\xe1\x86\xa8\xe1\x84\x80\xe1\x85\xae\xe1\x86\xa8 \xe1\x84\x83\xe1\x85\xa9\xe1\x86\xbc\xe1\x84\x92\xe1\x85\xa3\xe1\x86\xbc, 1984. \xe1\x84\x8c\xe1\x85\xa5\xe1\x86\xab4\xe1\x84\x80\xe1\x85\xaf\xe1\x86\xab(V.3 8.21-9.5).pdf'
print unicodedata.normalize('NFC', nfc_string)
@spikeekips
spikeekips / convert-miltiple-images-to-pdf.sh
Last active April 16, 2016 07:42
Convert multiple images to pdf
# from http://xmodulo.com/convert-jpg-image-file-to-pdf-format-on-linux.html
# install ghostscript
gs -sDEVICE=pdfwrite -o output.pdf /usr/share/ghostscript/8.71/lib/viewjpeg.ps -c "(intput1.jpg) viewJPEG showpage (input2.jpg) viewJPEG showpage (intput3.jpg) viewJPEG showpage"
@spikeekips
spikeekips / gist:0f05edf966ed2b6d0e90793fa7397e09
Created April 16, 2016 09:30
See latest logs using `tac`
$ tail /var/log/auth.log | tac
@spikeekips
spikeekips / pretty_hangul_print.py
Last active June 23, 2016 06:25
한글이 포함된 python literal들을 유니코드세트 대신 한글 그대로 출력. (http://m.egloos.zum.com/mcchae/v/11076302 참고)
# -*- coding: utf-8 -*-
import pprint
class MyPrettyPrinter(pprint.PrettyPrinter):
def format(self, _object, context, maxlevels, level):
if isinstance(_object, unicode):
return "'%s'" % _object.encode('utf8'), True, False
elif isinstance(_object, str):
# -*- coding: utf-8 -*-
"""
# nfc2nfd.py
Simply convert nfc(ed) file to nfd(ed) file
Written by Spike^ekipS <spikeekips@gmail.com>
# Installation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spikeekips
spikeekips / split_hangul_syllables.py
Created September 2, 2016 12:50
Splitting Hangul Jongsung Code
# -*- coding: utf-8 -*-
"""
Copyright 2005 Spike^ekipS <spikeekips@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,