Skip to content

Instantly share code, notes, and snippets.

Avatar
🦑
🦜 🦜 🦜 🦜

Dongsung Kim kiding

🦑
🦜 🦜 🦜 🦜
View GitHub Profile
@kiding
kiding / thechoiceisyours.js
Last active Sep 9, 2021
thechoiceis466560 - All the Matrix 4 Teasers
View thechoiceisyours.js
/*
This script checks ALL the possible Matrix 4 teaser URLs for their existence using HTTP HEAD.
Although the PR statement says the number of combinations is "more than 180,000,"
the actual app.js indicates there are actually 466,560 mp4 files generated and uploaded to S3.
It's possible some footages were recycled; maybe b = 1 and b = 3 are the same, etc.
*/
const { createHash } = require('crypto');
const https = require('https');
@kiding
kiding / NoScrollOnInputFocusiOSSafari.html
Last active Apr 17, 2022
Preventing iOS Safari scrolling when focusing on input elements
View NoScrollOnInputFocusiOSSafari.html
<!--
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.**
@kiding
kiding / install.sh
Last active Feb 24, 2022
Heterogeneous Homebrew: Apple Silicon & Intel Rosetta 2 side-by-side
View install.sh
# 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 / HDRGainMap.swift
Last active Aug 4, 2022
Extracting HDR Gain Map from iOS 14.1+ (iPhone 12+) photos
View HDRGainMap.swift
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 / KeepAll.playground.swift
Last active Apr 21, 2021
word-break: keep-all; but in Swift
View KeepAll.playground.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 / 2018-2019.diff
Created May 30, 2019
(2018|2019)년도 병역지정업체 선정 및 (2019|2020)년도 인원배정 고시
View 2018-2019.diff
1,4c1,4
< ◉병무청고시제2018-1호
< 2018년도 병역지정업체 선정 및 2019년도 인원배정 고시
< 2018년도 병역지정업체 선정 및 2019년도 인원배정에 대하여 다음과 같이 고시합니다.
< 2018년 5월 23일
---
> ◉병무청고시 제2019-2호
> 2019년도 병역지정업체 선정 및 2020년도 인원배정 고시
> 2019년도 병역지정업체 선정 및 2020년도 인원배정에 대하여 다음과 같이 고시합니다.
> 2019년 5월 27일
@kiding
kiding / KakaoTalk+.js
Last active Jan 28, 2019
KakaoTalk+: No More Search Pane (macOS)
View KakaoTalk+.js
/*
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 / BCM.hcd.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

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@kiding
kiding / hangulJosa.js
Created Oct 9, 2014
한글 조사 자동 선택 스크립트
View hangulJosa.js
/**
* 한글조사 - 은/는 이/가 을/를 과/와 이여/여
* @author Dongsung Don Kim <kiding@me.com>
* @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]/;