Skip to content

Instantly share code, notes, and snippets.

View nickcheng's full-sized avatar
🛴
Transforming

nickcheng nickcheng

🛴
Transforming
View GitHub Profile
@nickcheng
nickcheng / config.json
Created November 24, 2017 09:35
VSCode configuration.
{
"editor.fontFamily": "Iosevka-Light",
"editor.fontSize": 14,
"[markdown]": {
"editor.lineHeight": 25
},
"files.associations": {
"*.podspec": "ruby"
},
// "editor.tokenColorCustomizations": {
@nickcheng
nickcheng / refs.md
Created October 18, 2017 07:58
[Secure strings in your iOS app] secure things like api secret etc.
@nickcheng
nickcheng / script.sh
Last active December 16, 2019 05:41
Getting start/end time of your computer.
# Start
pmset -g log | grep "Lid Open"
# End
pmset -g log | grep "Clamshell"
# More Info
pmset -g log|grep -e " Sleep " -e " Wake "
@nickcheng
nickcheng / forcepull.sh
Created August 31, 2017 11:36
How to do "git pull --force".
git fetch --all
git reset --hard <branch_name>
@nickcheng
nickcheng / script.sh
Last active November 10, 2017 00:41
Search files by keyword in current folder.
find . -iname "*keyword*"
@nickcheng
nickcheng / convert.sh
Created July 8, 2017 02:38
Convert gif to mp4 via ffmpeg.
ffmpeg -r 30 -i input.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4
@nickcheng
nickcheng / script.sh
Last active June 26, 2017 04:03
Get audio from youtube video
# Download only audio from a Youtube link.
youtube-dl -f 'bestaudio' https://www.youtube.com/video
# Get the details of the file.
ffprobe file.mp4
# Get audio part from the input video file.
ffmpeg -i input.mp4 -vn -acodec copy output.aac
# Encode input file type to output type.
@nickcheng
nickcheng / appdocdir.zsh
Last active May 15, 2023 15:28
Open your app's Documents folder on iOS simulator.
function myappdocdir() {
devid=$(xcrun simctl list devices | grep Booted | sed -n 's/^.*\([A-F0-9]\{8\}-\([A-F0-9]\{4\}-\)\{3\}[A-F0-9]\{12\}\).*$/\1/p')
for folder in ~/Library/Developer/CoreSimulator/Devices/$devid/data/Containers/Data/Application/*; do
if [[ -a $folder/.com.apple.mobile_container_manager.metadata.plist ]]; then
if [[ 'com.apple.phone' = $(/usr/libexec/PlistBuddy -c 'Print :MCMMetadataIdentifier' $folder/.com.apple.mobile_container_manager.metadata.plist) ]]; then
echo $folder
break
fi
fi
done

Check which branch has a specific commit:

git branch --contains 7632ae3be603f7c80e33b2e38731e7f93bfb18de

Git search(search from description):

git log -g --grep=bitcode

# initialization file (not found)