Skip to content

Instantly share code, notes, and snippets.

@ChaosJohn
ChaosJohn / osx-for-hackers.sh
Created January 5, 2016 06:45 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@ChaosJohn
ChaosJohn / arch-xhyve.sh
Created October 15, 2015 08:40 — forked from lloeki/arch-xhyve.sh
Run Arch Linux in xhyve
#!/bin/bash
tmp=$(mktemp -d)
pushd "$tmp"
iso=/Users/lloeki/Downloads/archlinux-2015.08.01-dual.iso
echo "fixing disk"
dd if=/dev/zero bs=2k count=1 of=tmp.iso
dd if=$iso bs=2k skip=1 >> tmp.iso
echo "mounting disk"
@ChaosJohn
ChaosJohn / config.json
Created July 2, 2019 14:49 — forked from wd/config.json
路由器梅林固件上面使用 v2ray 的方案
{
"log": {
"loglevel": "none"
},
"inbound": {
"port": 23456,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true
@ChaosJohn
ChaosJohn / exercise.tour.go
Created December 20, 2018 06:17 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@ChaosJohn
ChaosJohn / miniconda_on_rpi.md
Created November 29, 2018 15:19 — forked from simoncos/miniconda_on_rpi.md
Install Miniconda 3 on Raspberry Pi
#!/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
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.9/rx.lite.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
1, 2
<script id="jsbin-javascript">
@ChaosJohn
ChaosJohn / installDockerMachine.sh
Last active April 12, 2018 10:09
Install docker-machine executable from official (Automatically check the running system)
#!/bin/sh
# Extract the value for the key
function jsonValue() {
KEY=$1
num=$2
awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p
}
# Get the latest version name from github