Skip to content

Instantly share code, notes, and snippets.

@ChaosJohn
ChaosJohn / __init__py
Last active Jan 4, 2021 — forked from seanbehan/app.py
Flask with Django ORM
View __init__py
"""
Located under app/
"""
import os
from django.apps import apps
from django.conf import settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
@ChaosJohn
ChaosJohn / config.json
Created Jul 2, 2019 — forked from wd/config.json
路由器梅林固件上面使用 v2ray 的方案
View config.json
{
"log": {
"loglevel": "none"
},
"inbound": {
"port": 23456,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true
@ChaosJohn
ChaosJohn / exercise.tour.go
Created Dec 20, 2018 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
View exercise.tour.go
/* 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 Nov 29, 2018 — forked from simoncos/miniconda_on_rpi.md
Install Miniconda 3 on Raspberry Pi
View miniconda_on_rpi.md
@ChaosJohn
ChaosJohn / ramdisk.sh
Created Oct 11, 2018 — forked from rxin/ramdisk.sh
ramdisk create/delete on Mac OS X.
View ramdisk.sh
#!/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
View install_sublime_text.sh
#!/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 Sep 27, 2018 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
View axios-catch-error.js
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 Jul 4, 2018 — forked from jbub/clean-macports.sh
Clean macports temporary build files and remove inactive ports.
View clean-macports.sh
# remove all temporary build files
sudo port clean --all installed
# remove all inactive ports
sudo port -f uninstall inactive
View index.html
<!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 / proxy.py
Created Apr 19, 2018 — forked from darkwave/proxy.py
Python proxy server to redirect calls from localhost to different address (change forward_to variable)
View proxy.py
#!/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