Skip to content

Instantly share code, notes, and snippets.

View charliecm's full-sized avatar

Charlie Chao charliecm

View GitHub Profile
@charliecm
charliecm / main.css
Created August 13, 2021 04:33
Obsidian custom CSS snippets.
/* ROOT -------------------------------------------------------------------- */
:root {
--default-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-weight: 700;
}
@charliecm
charliecm / bookmarklets.md
Last active December 7, 2019 22:34
Useful bookmarklets for adding items to your accounts.

Useful Bookmarklets

Browser extensions tend to inject CSS/JS into every webpage your visit. A cleaner approach is to use bookmarklets. Simply add the snippets below as bookmarks and access them from your bookmark/address bar.

Pocket

Bookmarklet / Bookmarklet with Login Fix

javascript:window.open('https://getpocket.com/edit?url='+document.location,'PocketAdd','height=360,width=600')
@charliecm
charliecm / copy-gps.sh
Created October 15, 2017 16:37
Copies GPS info from one image to another using exiftool.
#!/usr/bin/env bash
# arg 1 = source, arg 2 = destination
lon=$(exiftool -s3 -GPSLongitude "$1")
lat=$(exiftool -s3 -GPSLatitude "$1")
alt=$(exiftool -s3 -GPSAltitude "$1")
exiftool -GPSLongitude="$lon" -GPSLatitude="$lat" -GPSAltitude="$alt" "${@:2}"
@charliecm
charliecm / git-zip.sh
Created March 24, 2017 21:51
Export git repo as zip for sharing or submitting an assignment.
# http://gitready.com/intermediate/2009/01/29/exporting-your-repository.html
git archive HEAD --format=zip > archive.zip
@charliecm
charliecm / .eslintrc
Created February 11, 2017 19:07
My personal JS coding style.
{
"env": {
"browser": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
"tab"
],
@charliecm
charliecm / gh-pages.sh
Created November 17, 2016 17:10
Publish a subfolder to GitHub Pages; from https://gist.github.com/cobyism/4730490
git subtree push --prefix dist origin gh-pages
@charliecm
charliecm / image-to-video.bash
Created February 8, 2016 17:53
Sample snippet for converting a sequence of JPG images into a video (good for timelapse).
ffmpeg -r 25 -start_number 0 -i 'frame_%05d.jpg' -c:v libx264 -vf 'fps=25,format=yuv420p' out.mp4
@charliecm
charliecm / video-crop.bash
Last active September 10, 2016 18:55
Some video cropping snippets using ffmpeg.
# Crop to 1240x768 (tablet) on retina screen
ffmpeg -i input.mp4 -filter:v "crop=2048:1536:256:32" output.mp4
# Center video onto 1920x1080 canvas with white background
ffmpeg -i input.mov -vf "scale=min(iw*1080/ih\,1920):min(1080\,ih*1920/iw),pad=1920:1080:(1920-iw)/2:(1080-ih)/2:color=white" output.mov
@charliecm
charliecm / exiftool-snippets.bash
Last active November 13, 2023 23:43
Useful metadata editing and batch renaming snippets using exiftool.
# Changing metadata -----------------------------------------------------------
# Copy tags from one file to another
# http://thomer.com/howtos/copy_exif.html
exiftool -TagsFromFile a.jpg b.jpg
# Photos — change CreateDate metadata
exiftool "-CreateDate=2017:05:17 12:00:00" IMG.jpg
# Videos — change date to "Creation Date" (written by DSLRs)
var gulp = require('gulp');
var exec = require('child_process').exec;
gulp.task('default', function (cb) {
exec('sketchtool export slices assets/icons.sketch --output=assets/icons/', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});