Skip to content

Instantly share code, notes, and snippets.

@jpwain
jpwain / resize.scpt
Created April 23, 2020 21:31
Resize a Mac window to exact dimensions
(*
This Apple script will resize any program window to an exact size and the window is then moved to the center of your screen. Specify the program name, height and width below and run the script.
Written by Amit Agarwal on December 10, 2013
*)
set theApp to "Slack"
set appHeight to 1080
@jpwain
jpwain / gist:0185b68a47d6aeee334663c8c3716c91
Last active August 30, 2018 20:22
Browsersync syntax
# some recent change seems to make whatever I was using previously not work at all
browser-sync --index "./index.html" --server --files "./*.*"
# OR
browser-sync --index "index.html" --server --no-notify --files "*.*"
# --no-notify prevents that banner from appearing
# whatever, now this works:
browser-sync start -s -f . --no-notify --host $LOCAL_IP --port 9000 --index "base.html"
@jpwain
jpwain / gist:abf0ed6df17ef3836f9aed7565b9167c
Created June 30, 2017 23:14
How to reduce favicon size
Make PNGs at various sizes.
Merge with imagemagick `convert favicon16.png favicon32.png favicon.ico`
Reduce colorspace `convert -colors 4 favicon.ico favicon2.ico`
@jpwain
jpwain / sizecheck.sh
Created May 4, 2017 17:54
asset size comparison
#!/bin/bash
ARGC=$#
# if no directory specified, use current
if [ $ARGC -eq 0 ]
then
BASEDIR=${PWD}
else
BASEDIR=${1}
@jpwain
jpwain / mov2gif-ffmpeg-gifsicle.txt
Last active November 22, 2016 20:55
GIF from QuickTime screen capture using ffmpeg and gifsicle
ffmpeg -i input.mov -s 640x480 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=5 > output.gif
@jpwain
jpwain / android-display-to-mac.md
Last active October 23, 2022 12:23
Pipe Android device display to local Mac display using ffmpeg

On the Android device, enable Developer options, and enable USB debugging.

On the Mac:

$ brew install ffmpeg --with-ffplay

$ adb shell screenrecord --output-format=h264 - | ffplay - -x 720 -y 1280

Replace the 720 and 1280 with other values to scale the output as desired.