Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Sublime Text 3 Install (last update: Monday 13 March 2017)
#
# No need to download this script, just run it on your terminal:
#
# curl -L git.io/sublimetext | sh
# Detect the architecture
@ChaosJohn
ChaosJohn / axios-catch-error.js
Created September 27, 2018 10:02 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
axios.put(this.apiBaseEndpoint + '/' + id, input)
.then((response) => {
// Success
})
.catch((error) => {
// Error
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
// console.log(error.response.data);
@ChaosJohn
ChaosJohn / clean-macports.sh
Created July 4, 2018 13:35 — forked from jbub/clean-macports.sh
Clean macports temporary build files and remove inactive ports.
# remove all temporary build files
sudo port clean --all installed
# remove all inactive ports
sudo port -f uninstall inactive
@ChaosJohn
ChaosJohn / proxy.py
Created April 19, 2018 10:05 — forked from darkwave/proxy.py
Python proxy server to redirect calls from localhost to different address (change forward_to variable)
#!/usr/bin/python
# This is a simple port-forward / proxy, written using only the default python
# library. If you want to make a suggestion or fix something you can contact-me
# at voorloop_at_gmail.com
# Distributed over IDC(I Don't Care) license
import socket
import select
import time
import sys
@ChaosJohn
ChaosJohn / KotlinGson.java
Last active January 20, 2018 07:02 — forked from leoleozhu/Foo.java
Use gson to parse integer array
package com.foo;
import java.util.Arrays;
import java.util.List;
import com.google.gson.Gson;
public class KotlinGson {
private static List<Integer> toList(String json, Gson parser) {
@ChaosJohn
ChaosJohn / visualstudiocode.sh
Created March 15, 2017 17:26 — forked from ted-piotrowski/visualstudiocode.sh
Visual Studio Code on ARM Debian Linux
# building Visual Studio Code Debian package on ARM
# get source code
git clone git@github.com:Microsoft/vscode.git
cd vscode
# build debian package
./scripts/npm.sh install --arch=armhf
./node_modules/.bin/gulp vscode-linux-arm-build-deb
@ChaosJohn
ChaosJohn / gist:485683c8c845f340ff74f32f9d7f3d58
Created February 11, 2017 02:02 — forked from rtrouton/gist:f92f263414aaeb946e54
Install Xcode command line tools on 10.7.x - 10.10.x. Tested on 10.7.5, 10.8.5, 10.9.5 and 10.10.2.
#!/bin/bash
# Installing the Xcode command line tools on 10.7.x or higher
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
# Installing the latest Xcode command line tools on 10.9.x or higher
if [[ "$osx_vers" -ge 9 ]]; then
@ChaosJohn
ChaosJohn / update_gfwlist.sh
Created December 14, 2016 02:38 — forked from VincentSit/update_gfwlist.sh
Automatically update the PAC for ShadowsocksX. Only tested on OS X.
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)
@ChaosJohn
ChaosJohn / ATS.plist
Created September 21, 2016 11:49 — forked from onevcat/ATS.plist
Fuck off ATS
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
@ChaosJohn
ChaosJohn / brew-cask-upgrade.sh
Created August 22, 2016 06:35 — forked from c00kiemon5ter/brew-cask-upgrade.sh
a portable shell script to upgrade cask packages
#!/bin/sh
help=0
latest=0
verbose=0
status=0
usage() {
cat <<-EOF
${0##*/} [options]