Skip to content

Instantly share code, notes, and snippets.

View nickcheng's full-sized avatar
🛴
Transforming

nickcheng nickcheng

🛴
Transforming
View GitHub Profile
@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
@nickcheng
nickcheng / script.sh
Last active August 30, 2018 01:03
[git-radar prompt setting in .zshrc] #zsh #on-my-zsh #git
# git-radar
# Installation: brew install michaeldfallen/formula/git-radar
# Source: https://github.com/michaeldfallen/git-radar
export PROMPT='
%{$fg_bold[white]%}%T%{$reset_color%}\
%{$fg[cyan]%} %n%{$reset_color%}\
%{$fg_bold[green]%} %d%{$reset_color%}\
$(git-radar --zsh --fetch) \
%{$fg[white]%}[%*] $exit_code
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}'
@nickcheng
nickcheng / script.sh
Last active August 23, 2018 02:11
[Remove merged branches locally] except current branch, master branch and develop branch #git
# In CLI
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d
# As a shell alias
alias gbpurge='git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d'
@nickcheng
nickcheng / script.sh
Created July 16, 2018 09:49
[ffmpeg command for converting SONY RX100ii video to MP4 format] #rx100 #video #ffmpeg
ffmpeg -i input.MTS -c:v copy -c:a aac -strict experimental -b:a 256k output.mp4