Skip to content

Instantly share code, notes, and snippets.

@johnlinvc
johnlinvc / gist:6077375
Last active December 20, 2015 05:19 — forked from jtescher/gist:1487555
capistrano task for optimize images after asset:precompile using optipng and jpegoptim
namespace :image_compression do
desc 'Optimize images with optipng and jpegoptim'
task :process do
# Check for optipng
if (!`which optipng`.empty? rescue false) # rescue on environments without `which` (windows)
# Crush all .png files inplace
run "find #{shared_path}/assets/ -type f -name '*.png' -print0 | xargs -0 optipng -quiet -o7 "
else
# Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files
# for Pry binding references
#
# Installation
#
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit
#
# Based on
#
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/
@johnlinvc
johnlinvc / swift-amzn-ami.sh
Created October 7, 2016 13:56 — forked from carsonmcdonald/swift-amzn-ami.sh
Build Swift on an Amazon Linux AMI
#
# Notes:
#
# I used the following AMI:
# "Amazon Linux AMI 2015.09.1 (HVM), SSD Volume Type - ami-60b6c60a"
# Running on AMI: amzn-ami-hvm-2015.09.1.x86_64-gp2 (ami-60b6c60a)
#
# You probably want to use an instance type with a large amount of memory. My first
# attempt was with a c4.2xlarge but it rant out of memory without using -j option to
# limit the parallel build.
@johnlinvc
johnlinvc / installing_MTGA_on_macOS_with_Retina_support.md
Created May 24, 2019 05:46 — forked from prestia/installing_MTGA_on_macOS_with_Retina_support.md
Instructions on how to install Magic the Gathering Arena on macOS with Retina support.

Installing MTGA on macOS using Wine, and making it look pretty!

The following instructions are heavily inspired by /u/uhohohdear. I modified uhohohdear's instructions and then added support for Retina/HiDPI displays and instructions about how to update MTGA.

Dependencies

  1. Your macOS/OS X version must be 10.8 or greater
  2. Your Mac must support OpenGL 4.0 or greater (you can find out whether it does here)
  3. You must download the Magic the Gathering Arena Windows executable
  4. You must download a custom Wineskin wrapper [mirror]
@johnlinvc
johnlinvc / xcode-downloader.rb
Created October 8, 2020 08:14 — forked from iandundas/xcode-downloader.rb
Script for reliably downloading binaries (e.g. Xcode) from Apple's CDN
#!/usr/bin/env ruby
print "What is the URL of your Apple Downloads resource?\nURL:"
url = gets.strip
print "What is the ADCDownloadAuth cookie token:\nADCDownloadAuth: "
token = gets.strip
command = "aria2c --header \"Host: adcdownload.apple.com\" --header \"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\" --header \"Upgrade-Insecure-Requests: 1\" --header \"Cookie: ADCDownloadAuth=#{token}\" --header \"User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1\" --header \"Accept-Language: en-us\" -x 16 -s 16 #{url} -d ~/Downloads"