Skip to content

Instantly share code, notes, and snippets.

#/bin/sh
soffice --headless --convert-to html:HTML "$1"
basename=$(basename "$1")
filename="${basename%.*}"
html2text "$filename.html" > "$filename.md"
<?php
// Emulate register_globals on
// source: http://php.net/manual/en/faq.misc.php#faq.misc.registerglobals
if (!ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
<?php
// Emulate register_globals off
// source: http://php.net/manual/en/faq.misc.php#faq.misc.registerglobals
function unregister_GLOBALS()
{
if (!ini_get('register_globals')) {
return;
}
// Might want to change this perhaps to a nicer error
/**
초성 중성 종성 분리 하기
유니코드 한글은 0xAC00 으로부터
초성 19개, 중상21개, 종성28개로 이루어지고
이들을 조합한 11,172개의 문자를 갖는다.
한글코드의 값 = ((초성 * 21) + 중성) * 28 + 종성 + 0xAC00
(0xAC00은 'ㄱ'의 코드값)
/**
초성 중성 종성 분리 하기
유니코드 한글은 0xAC00 으로부터
초성 19개, 중상21개, 종성28개로 이루어지고
이들을 조합한 11,172개의 문자를 갖는다.
한글코드의 값 = ((초성 * 21) + 중성) * 28 + 종성 + 0xAC00
(0xAC00은 'ㄱ'의 코드값)
@mytory
mytory / iconv.php
Last active December 20, 2015 21:39
Convert file encoding with `//IGNORE` flag. This script convert a file, can`t convert files. usage: php iconv.php from-encoding to-encoding filename
<?php
// filename : iconv.php
if($argc != 4){
echo "invalid arg!\nsyntax) php {$argv[0]} from to filename\nex) php {$argv[0]} euc-kr utf-8 /path/to/filename\n";
exit(0);
}
$from = $argv[1];
$to = $argv[2];
$filename = $argv[3];
@mytory
mytory / gist:6238053
Created August 15, 2013 03:33
my .bash_profile
export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\n\[\e[0m\]$ '
export PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH"
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
export EDITOR=nano
PATH=$PATH:/usr/local/mysql/bin
alias ls='gls --color=auto -F'
source .git-completion.bash
@mytory
mytory / mytory-bind-tab-navigation.js
Last active December 21, 2015 10:29
easy bind tab navigation.
/**
* ex)
* bind_tab_navigation({
* target: ".family-site__a",
* prev: '.brand-page-last',
* prev_pre_event: function(){
* $('.brand-page-content').show();
* },
* next: '.family-site-first',
* next_pre_event: function(){
// Simulates PHP's date function
Date.prototype.format = function(format) {
var returnStr = '';
var replace = Date.replaceChars;
for (var i = 0; i < format.length; i++) { var curChar = format.charAt(i); if (i - 1 >= 0 && format.charAt(i - 1) == "\\") {
returnStr += curChar;
}
else if (replace[curChar]) {
returnStr += replace[curChar].call(this);
} else if (curChar != "\\"){
@mytory
mytory / randombg.sh
Last active December 30, 2015 03:59
Select a file on specified directory, and set that to wallpaper using Esetroot. I'm using this script to change wallpaper by 5 minutes on fluxbox with cron.
#!/bin/sh
filename=$(shuf -n1 -e /home/mytory/wallpapers/*)
Esetroot -f $filename