Skip to content

Instantly share code, notes, and snippets.

View nickcheng's full-sized avatar
🛴
Vibing

nickcheng nickcheng

🛴
Vibing
View GitHub Profile
@nickcheng
nickcheng / script.js
Created December 10, 2025 11:45
This is a script for using in the Draft app on macOS. It toggles the checkbox state on selected lines.
// This is a script for using in the Draft app on macOS
// It toggles the checkbox state on selected lines
// Toggle tasks marks on selected lines
var offState = "- [ ]";
var onState = "- [x]";
// Normalize leading spaces to multiples of 4 (0, 4, 8, 12, ...)
function normalizeIndent(spacesCount) {
return Math.floor(spacesCount / 4) * 4;
@nickcheng
nickcheng / style.css
Created June 11, 2025 07:36
Stylus style - Notion Font Heading Changer
/* ==UserStyle==
@name notion-custom-fonts-heading
@version 20250611.16.34
@namespace https://nickcheng.com
@description customize your notion fonts (cjk + latin) and heading style
@author nickcheng
@license MIT
==/UserStyle== */
@-moz-document domain("notion.so") {
@nickcheng
nickcheng / style.css
Created October 31, 2024 06:58
Change the fonts in Notion via Stylus
/* ==UserStyle==
@name notion-custom-fonts
@version 20240503.19.42
@namespace https://userstyles.world/user/aquariuslt
@description customize your notion fonts (cjk + latin)
@author aquariuslt
@license MIT
==/UserStyle== */
@-moz-document domain("notion.so") {
/* define cjk font here */
@nickcheng
nickcheng / script.js
Created August 28, 2023 08:35
Violentmonkey(GreaseMonkey) script for showing if the day has been mended on Jobcan.
// ==UserScript==
// @name script - jobcan.jp
// @namespace Violentmonkey Scripts
// @match https://ssl.jobcan.jp/employee/attendance*
// @grant
// @version 1.0
// @author Nick
// @description 8/28/2023, 1:40:55 PM
// ==/UserScript==
ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4
@nickcheng
nickcheng / script.sh
Created February 13, 2020 07:31
Convert iPhone video to smaller size
# For horizontal video
ffmpeg -i input_file_name -c:v libx264 -c:a copy -r 25 -b 3.5M -s 768x432 output_file_name
# For portrait video
ffmpeg -i input_file_name -c:v libx264 -c:a copy -r 25 -b 3.5M -s 432x768 output_file_name
@nickcheng
nickcheng / init.lua
Last active July 12, 2021 01:13
Hammerspoon script to turn cursor moving to scrolling while holding right button on trackball.
-- HANDLE SCROLLING
local deferred = false
overrideRightMouseDown = hs.eventtap.new({ hs.eventtap.event.types.rightMouseDown }, function(e)
--print("down"))
deferred = true
return true
end)
@nickcheng
nickcheng / script.sh
Last active March 26, 2019 06:08
Batch extract audio from video.
#! /bin/zsh
array=(*.mkv);for i ($array){num=$(echo $i|grep -Eo "第[0-9]+"|grep -Eo "[0-9]+");ffmpeg -i $i -vn xnj$num.m4a;}
@nickcheng
nickcheng / script.sh
Created October 5, 2018 00:50
[This may solve quicklook stucking in Mojove] #mojave #quicklook #macos
sudo update_dyld_shared_cache -force
qlmanage -r
@nickcheng
nickcheng / script.sh
Last active October 5, 2018 00:50
[Combine CSV files by column name] #csv
# Need csvkit
# Ref: https://github.com/wireservice/csvkit/issues/245
csvjson --stream file_1.csv >> combined.jsonl
csvjson --stream file_2.csv >> combined.jsonl
in2csv --format ndjson combined.jsonl >> combined.csv