Skip to content

Instantly share code, notes, and snippets.

@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"
@johnlinvc
johnlinvc / Gemfile
Last active August 2, 2020 06:24
Coscup 2020 Ruby Byebug
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem 'byebug'
@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]
import os
import subprocess
os.environ["hello"] = "world"
subprocess.call(["python", "b.py"])
@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 / basketball.swift
Created April 11, 2016 15:58
basket ball shooting in spritekit
//: Playground - noun: a place where people can play
/*
README
just copy & paste the code into an iOS playground of Xcode 7.3+
click display timeline to play in the liveview
*/
import UIKit
import SpriteKit
require 'nokogiri'
str = <<END
<cve xmlns:xsi="xxx">
<member>yyy</member>
</cve>
END
doc = Nokogiri::XML(str)
cve = doc.xpath("//cve")[0]
namespaces = cve.namespaces
/*
Web Server
A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
* Analog inputs attached to pins A0 through A5 (optional)
@johnlinvc
johnlinvc / echo_server.rb
Created January 1, 2016 10:40
ruby rack echo server
require 'rack'
app = Proc.new do |env|
['200', {'Content-Type' => 'text/html'},
["hello #{env['rack.input'].read}"]]
end
Rack::Handler::WEBrick.run app
@johnlinvc
johnlinvc / buildlog.sh
Created December 30, 2015 16:36
swift-stdlib-macosx-x86_64 build fail log
Building the standard library for: swift-stdlib-macosx-x86_64
cmark: using standard linker
++ cmake_config_opt cmark
++ product=cmark
++ [[ Ninja == \X\c\o\d\e ]]
+ /usr/local/bin/cmake --build /Users/johnlinvc/Projs/swift-core-2/build/Ninja-DebugAssert/cmark-macosx-x86_64 -- -j8 all
ninja: no work to do.
llvm: using standard linker
++ cmake_config_opt llvm