Skip to content

Instantly share code, notes, and snippets.

View Zeta611's full-sized avatar
๐ŸŽฏ
Focusing

Jay Lee Zeta611

๐ŸŽฏ
Focusing
View GitHub Profile
@Zeta611
Zeta611 / drawShifted.asy
Last active May 31, 2020 08:06
[drawShifted] Shift a path by an absolute value in Asymptote
void drawShifted(
path g,
pair trueshift,
picture pic=currentpicture,
Label label="",
pen pen=currentpen,
arrowbar arrow=None,
arrowbar bar=None,
margin margin=NoMargin,
marker marker=nomarker
@Zeta611
Zeta611 / pathLabel.asy
Last active May 31, 2020 08:04
[pathLabel] Add a label to a path
void pathLabel(
picture pic=currentpicture,
Label l,
path g,
real position=0.5,
align align=NoAlign,
bool sloped=false,
pen p=currentpen,
filltype filltype=NoFill
) {
@Zeta611
Zeta611 / sample.lua
Last active May 31, 2020 08:02
[Lua sample] Simple demo of a Lua code #demo
-- Use a builder to safely make objects
function build_complex(r, i)
return {real = r, img = i}
end
-- Accessing a value with a key
complex = build_complex(3, 4)
assert(complex["real"] == complex.real)
print(complex.real)
@Zeta611
Zeta611 / capture.lua
Last active May 31, 2020 08:02
[Lua capture] Shows a full lexical scoping of Lua
function enable_counting()
local count = 0
local old_print = print
print = function(...)
count = count + 1
old_print(...)
end
return function() return count end
end
@Zeta611
Zeta611 / List.swift
Last active August 9, 2022 12:51
[List] Demonstration of a recursive data type in Swift #algorithm #demo
precedencegroup ListOperationPrecedence {
associativity: right
higherThan: MultiplicationPrecedence
}
infix operator ++: ListOperationPrecedence
infix operator |*: ListOperationPrecedence
indirect enum List<T> {
case `nil`
@Zeta611
Zeta611 / memoize.ml
Created March 13, 2020 14:26
[memoize] General memoization function #algorithm
let memoize ?(size = 100) f =
let tbl = Hashtbl.create size in
let rec g = fun x ->
try Hashtbl.find tbl x
with Not_found ->
let v = f g x in
Hashtbl.add tbl x v;
v
in
f g
@Zeta611
Zeta611 / work.sh
Last active March 13, 2020 14:27
[ffmpeg script] #ffmpeg #automation
ffmpeg -i ~/lecture-videos/week1_edit.mov -ss 00:00:00 -t 00:13:00 ~/lecture-videos/week1_edit_part1.mp4
ffmpeg -ss 00:10:00 -i ~/lecture-videos/week1_edit.mov -t 00:13:00 ~/lecture-videos/week1_edit_part2.mp4
ffmpeg -ss 00:20:00 -i ~/lecture-videos/week1_edit.mov -t 00:13:00 ~/lecture-videos/week1_edit_part3.mp4
ffmpeg -ss 00:27:00 -i ~/lecture-videos/week1_edit.mov -t 00:13:44 ~/lecture-videos/week1_edit_part4.mp4
ffmpeg -ss 00:00:00 -i ~/lecture-videos/week2_edit.mov -t 00:13:00 ~/lecture-videos/week2_edit_part1.mp4
ffmpeg -ss 00:10:00 -i ~/lecture-videos/week2_edit.mov -t 00:13:00 ~/lecture-videos/week2_edit_part2.mp4
ffmpeg -ss 00:20:00 -i ~/lecture-videos/week2_edit.mov -t 00:13:00 ~/lecture-videos/week2_edit_part3.mp4
ffmpeg -ss 00:25:00 -i ~/lecture-videos/week2_edit.mov -t 00:13:26 ~/lecture-videos/week2_edit_part4.mp4
@Zeta611
Zeta611 / Android ๊ฐœ๋ฐœ์„ ์ˆ˜์ฃผํ•ด์„œ Kotlin์„ ์ œ๋Œ€๋กœ ์จ๋ดค๋”๋‹ˆ ์ตœ๊ณ ์˜€๋‹ค.md
Created December 18, 2019 09:01
Android ๊ฐœ๋ฐœ์„ ์ˆ˜์ฃผํ•ด์„œ Kotlin์„ ์ œ๋Œ€๋กœ ์จ๋ดค๋”๋‹ˆ ์ตœ๊ณ ์˜€๋‹ค๋ผ๋Š” ๊ธ€์„ ๋ฒˆ์—ญํ–ˆ์Šต๋‹ˆ๋‹ค.

Android ๊ฐœ๋ฐœ์„ ์ˆ˜์ฃผํ•ด์„œ Kotlin์„ ์ œ๋Œ€๋กœ ์จ๋ดค๋”๋‹ˆ ์ตœ๊ณ ์˜€๋‹ค.

๊ธ€์— ์•ž์„œ

์ด ๊ธ€์€ ์ผ๋ณธ์˜ omochimetaru๋‹˜์ด Qiita์— ์˜ฌ๋ฆฐ Android ๊ฐœ๋ฐœ์„ ์ˆ˜์ฃผํ•ด์„œ Kotlin์„ ์ œ๋Œ€๋กœ ์จ๋ดค๋”๋‹ˆ ์ตœ๊ณ ์˜€๋‹ค.๋ผ๋Š” ๊ธ€์„ ๋ฒˆ์—ญํ•ด์„œ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฒˆ์—ญ์„ ํ”์พŒํžˆ ํ—ˆ๋ฝํ•ด์ฃผ์‹  omochimetaru๋‹˜๊ป˜ ๊ฐ์‚ฌํ•˜๋‹ค๋Š” ๋ง์”€ ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๋˜ํ•œ ๊ธ€์—์„œ ํ•œ๊ตญ์—์„œ๋Š” ์“ฐ์ด์ง€ ์•Š๋Š” ํ‘œํ˜„๋“ค ๋“ฑ์— ๋Œ€ํ•ด์„œ๋Š” ์˜์—ญ์ด ์„ž์—ฌ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์  ์–‘ํ•ด ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๋Šฆ์€ ์‹œ๊ฐ„๊นŒ์ง€ ์˜ค์—ญ์„ ์ฐพ๊ณ  ๋ฒˆ์—ญ์˜ ์งˆ์„ ๋†’์ด๋Š”๋ฐ ๋งŽ์€ ๋„์›€์„ ์ฃผ์‹œ๊ณ  ์˜คํžˆ๋ ค ์ €๋ณด๋‹ค ๋งŽ์ด ๊ณ ์ƒํ•ด์ฃผ์‹  ์ด์ƒํ•œ๋ชจ์ž„์˜ pluulove๋‹˜, chiyodad๋‹˜, lemonade๋‹˜๊ป˜๋„ ๊ฐ์‚ฌํ•˜๋‹ค๋Š” ๋ง์”€ ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

Kotlin์„ ์‹ค๋ฌด ํ”„๋กœ์ ํŠธ์—์„œ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

๋ฉฐ์น  ์ „, ์ œ๊ฐ€ ์†Œ์†๋œ Qoncept์—์„œ "๋ฆฌ์–ผ ์ˆ ๋ž˜์žก๊ธฐ"xํ›„์ง€ํ ํ•˜์ด๋žœ๋“œ ๊ฑฐ๋Œ€ ์œ ์›์ง€์—์„œ๋ถ€ํ„ฐ์˜ ๋„์ฃผ๋ฅผ ๊ฐœ๋ฐœํ–ˆ๊ณ  ์ถœ์‹œํ–ˆ์Šต๋‹ˆ๋‹ค.

@Zeta611
Zeta611 / UIBarButtonItem+Badge.swift
Last active August 30, 2019 11:54 — forked from freedom27/UIBarButtonItem+Badge.swift
[UIBarButtonItem+Badge] #iOS #extension
//
// UIBarButtonItem+Badge.swift
//
// Created by Jaeho Lee on 30/08/2019.
// Copyright ยฉ 2019 Jay Lee <[email protected]>
//
// Original Source:
// https://gist.github.com/freedom27/c709923b163e26405f62b799437243f4
//
@Zeta611
Zeta611 / sieve.c
Last active February 24, 2020 01:12
[Sieve of Eratosthenes in C] #algorithm
/**
* sieve.c
*
* Created by Jay Lee on 08/25/2019.
* Copyright ยฉ 2019 Jay Lee <[email protected]>
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
*/