Skip to content

Instantly share code, notes, and snippets.

@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
@ChaosJohn
ChaosJohn / ramdisk.sh
Created October 11, 2018 07:26 — forked from rxin/ramdisk.sh
ramdisk create/delete on Mac OS X.
#!/bin/bash
# From http://tech.serbinn.net/2010/shell-script-to-create-ramdisk-on-mac-os-x/
#
ARGS=2
E_BADARGS=99
if [ $# -ne $ARGS ] # correct number of arguments to the script;
then
#!/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 [email protected]: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