Skip to content

Instantly share code, notes, and snippets.

View kiding's full-sized avatar
🦑
🦜 🦜 🦜 🦜

Dongsung "Donny" Kim kiding

🦑
🦜 🦜 🦜 🦜
View GitHub Profile
@kiding
kiding / sleepsortcocoa.m
Created January 17, 2012 15:51
Sleep Sort - Objective-C (Cocoa)
/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Dongsung "Don" Kim <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@kiding
kiding / gist:589242021df49eb17be3
Last active December 3, 2019 23:57
safari-utm-stripper Bookmarklet
javascript:(function()%7Bvar%20e%3Dwindow.location.href%3Bvar%20t%3De.indexOf(%22%3F%22)%3Bif(e.indexOf(%22utm_%22)%3Et)%7Bvar%20n%3De.replace(%2F(%5B%3F%26%5Dutm_(source%7Cmedium%7Cterm%7Ccampaign%7Ccontent)%3D%5B%5E%26%23%5D%2B)%2Fig%2C%22%22)%3Bif(n.charAt(t)%3D%3D%3D%22%26%22)%7Bn%3Dn.substr(0%2Ct)%2B%22%3F%22%2Bn.substr(t%2B1)%7Dif(n!%3De)%7Bhistory.replaceState(null%2Cnull%2Cn)%7D%7D%7D)();
@kiding
kiding / hangulJosa.js
Created October 9, 2014 16:42
한글 조사 자동 선택 스크립트
/**
* 한글조사 - 은/는 이/가 을/를 과/와 이여/여
* @author Dongsung Don Kim <[email protected]>
* @license MIT
*/
// TODO: 으로/로
var hangulJosa = (function() {
var reT = /[0136-80136-8L-NRL-NRㄱ-ㅎ\uFFA1-\uFFBE\u3165-\u3186\u1100-\u115E\u11A8-\u11FF]/,
// 영일삼육칠팔 반각 전각, 대문자 알파벳 엘엠엔 반각 전각, 자음, 반각 자금, 옛자음, 조합 초성, 조합 종성
reF = /[24592459A-KO-QS-ZA-KO-QS-Zㅏ-ㅣ\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u3187-\u318E\u1161-\u11A7]/;
@kiding
kiding / BCM.hcd.b64
Last active May 2, 2019 05:31
BCM4356A3 Firmware (for Nintendo Switch)
TPxGAIAhAEJSQ01jZmdTAAAAADIAAAABAQQYkgAAAAMGrB8Ao1ZDAAEcQoAhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP4AAEz8zEKAIQBCUkNNY2ZnRAAAAACuEgAAAwMgQ1lXNDM1NkEzXzAwMS4wMDQuMDA5LjAwNjIuMDA2NAAQAQ8A1KoBALXwlLsAAAACDQAQAQ8BjBMEAI7wPL8AAAgCDQAGAQRoCw0AEAEPAhjXAADC8IC9AAAcAg0AEAEPA2zeAADC8Cu/AADGDA0AEAEPBFzUAADC8OG+AAAiAg0AEAEPBbjPAADD8JK/AADgDg0AEAEPBuDYAADD8NW7AACOEA0AEAEPB0zTAADD8AG/AABSEUz8zAqBIQANABABDwgQ7QAAwfCLugAAKgINABABDwk8FQgATvB+vgAAPAINABABDwoMuAcAVPAavQAARAINABABDwtGuAcAVPAEvQAAUgINABABDwz4vwcAVfCIuQAADBMNABABDw2kxQcAAL8q4AAAAAAAABABDw6cJgcAXfDgvQAAYAINABABDw88cQQAifCcuAAAeAINABABDxDYdwQAiPBQvQAAfAINABABDxFQegQAiPAbvAAAigINABABDxIogwQAh/C1vwAAlgINAEz8zNKBIQAQAQ8T0IMEAAC/AL8AAAAAAAAGAQSIGA0AEAEPFGxzBACK8Jy6AACoGA0AEAEPFZh1BACI8IW+AACmAg0AEAEPFuxkBACJ8OC+AACwAg0AEAEPF6hQBwBb8AS5AAC0Ag0AEAEPGORRBwBb8HG4AADKAg0AEAEPGZyQBACH8Bi5AADQAg0AEAEPGkQ+BACN8GK/AAAMHQ0AEAEPGyQ9BACM8Ni6AADYAg0AEAEPHPBBAQC88Ha4AADgAg0AEAEPHdA5AQC+8Iq7AEz8zJqCIQAA6CANABABDx7EewIAqvBVuwAAciINAAYBBOgoDQAQAQ8fJDwBAL7wZr4AAPQoDQAQAQ8gMDsBAL7wBr8AAEApDQAQ
@kiding
kiding / KakaoTalk+.js
Last active January 28, 2019 02:41
KakaoTalk+: No More Search Pane (macOS)
/*
Hide the annoying search pane.
$ sudo node KakaoTalk+.js
$ nohup /Applications/KakaoTalk.app/Contents/MacOS/KakaoTalk+ </dev/null >/dev/null 2>&1
*/
const { readFileSync, writeFileSync } = require('fs'),
{ execSync } = require('child_process'),
{ ok } = require('assert');
@kiding
kiding / 2018-2019.diff
Created May 30, 2019 01:11
(2018|2019)년도 병역지정업체 선정 및 (2019|2020)년도 인원배정 고시
1,4c1,4
< ◉병무청고시제2018-1호
< 2018년도 병역지정업체 선정 및 2019년도 인원배정 고시
< 2018년도 병역지정업체 선정 및 2019년도 인원배정에 대하여 다음과 같이 고시합니다.
< 2018년 5월 23일
---
> ◉병무청고시 제2019-2호
> 2019년도 병역지정업체 선정 및 2020년도 인원배정 고시
> 2019년도 병역지정업체 선정 및 2020년도 인원배정에 대하여 다음과 같이 고시합니다.
> 2019년 5월 27일
@kiding
kiding / KeepAll.playground.swift
Last active April 21, 2021 06:07
word-break: keep-all; but in Swift
import UIKit
class KRLayoutManagerDelegate: NSObject, NSLayoutManagerDelegate {
func layoutManager(_ layoutManager: NSLayoutManager,
shouldBreakLineByWordBeforeCharacterAt charIndex: Int) -> Bool {
if charIndex <= 0 {
return true
}
let string = layoutManager.textStorage?.string as NSString?
@kiding
kiding / HDRGainMap.swift
Last active October 29, 2024 14:26
Extracting HDR Gain Map from iOS 14.1+ (iPhone 12+) photos
import UIKit
import MobileCoreServices.UTCoreTypes
if #available(iOS 14.1, *) {
let input = Bundle.main.url(forResource: "IMG_0037", withExtension: "HEIC")!
let output = FileManager().temporaryDirectory.appendingPathComponent("IMG_0037.GAIN_MAP.BMP")
let source = CGImageSourceCreateWithURL(input as CFURL, nil)!
// urn:com:apple:photo:2020:aux:hdrgainmap
let dataInfo = CGImageSourceCopyAuxiliaryDataInfoAtIndex(source, 0, kCGImageAuxiliaryDataTypeHDRGainMap)! as Dictionary
@kiding
kiding / install.sh
Last active February 24, 2022 15:21
Heterogeneous Homebrew: Apple Silicon & Intel Rosetta 2 side-by-side
# Install Homebrew at /opt/homebrew (for Apple Silicon)
arch -arm64e /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Homebrew at /usr/local (for Intel Rosetta 2)
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add these lines to ~/.zshrc
alias za="arch -arch arm64e /bin/zsh"
alias zi="arch -arch x86_64 /bin/zsh"
if [[ $(arch) == "arm64" ]]; then
@kiding
kiding / NoScrollOnInputFocusiOSSafari.html
Last active December 25, 2024 08:00
Preventing iOS Safari scrolling when focusing on input elements
<!--
When an input element gets focused, iOS Safari tries to put it in the center by scrolling (and zooming.)
Zooming can be easily disabled using a meta tag, but the scrolling hasn't been quite easy.
The main quirk (I think) is that iOS Safari changes viewport when scrolling; i.e., toolbars shrink.
Since the viewport _should_ change, it thinks the input _will_ move, so it _should_ scroll, always.
Even times when it doesn't need to scroll—the input is fixed, all we need is the keyboard—
the window always scrolls _up and down_ resulting in some janky animation.
However, iOS Safari doesn't scroll when the input **has opacity of 0 or is completely clipped.**