Skip to content

Instantly share code, notes, and snippets.

View r1cebank's full-sized avatar
🎯
Focusing on rust

Siyuan Gao r1cebank

🎯
Focusing on rust
View GitHub Profile

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

const SerialPort = require('serialport')
const Readline = require('@serialport/parser-readline')
var port = new SerialPort('/dev/ttyUSB0', {
baudRate: 115200
});
const parser = port.pipe(new Readline({ delimiter: '\r\n' }))
parser.on('data', (data) => {
console.log(JSON.parse(data));
})
@r1cebank
r1cebank / interval.py
Created August 13, 2018 23:38
python interval
import time, threading
StartTime=time.time()
def action() :
print('action ! -> time : {:.1f}s'.format(time.time()-StartTime))
class setInterval :
def __init__(self,interval,action) :
@r1cebank
r1cebank / mario.lua
Created January 5, 2018 01:57
marIO
-- MarI/O by SethBling
-- Feel free to use this code, but please do not redistribute it.
-- Intended for use with the BizHawk emulator and Super Mario World or Super Mario Bros. ROM.
-- For SMW, make sure you have a save state named "DP1.state" at the beginning of a level,
-- and put a copy in both the Lua folder and the root directory of BizHawk.
if gameinfo.getromname() == "Super Mario World (USA)" then
Filename = "DP1.state"
ButtonNames = {
"A",
@r1cebank
r1cebank / flask-upload
Created September 28, 2017 16:00 — forked from dAnjou/flask-upload
Flask upload example
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess www user=max group=max threads=5
WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi
<Directory /home/max/Projekte/flask-upload>
WSGIProcessGroup www
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
@r1cebank
r1cebank / element.js
Last active August 14, 2017 17:28
chanable js - input validator
import isEmpty from 'lodash/isEmpty';
import validators from '../validators';
import noop from '../utils/noop.js';
function addProperty (context, name, getter) {
if (typeof getter !== 'function') { getter = function() { }; }
Object.defineProperty(context, name, {
get() {
const result = getter.call(this);
@r1cebank
r1cebank / siege
Created March 13, 2017 18:30 — forked from MikeNGarrett/siege
Siege with JSON POST data
siege -c50 -t60S -H 'Content-Type: application/json' 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}'
@r1cebank
r1cebank / custom-error.js
Created February 9, 2017 23:11 — forked from justmoon/custom-error.js
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
#!/usr/bin/env python3
# Python 3 code that will read, decompress, and then recompress the UE4 game
# save file that Astroneer uses.
#
# Though I wrote this for tinkering with Astroneer games saves, it's probably
# generic to the Unreal Engine 4 compressed saved game format.
import zlib
import sys
const fs = require('fs');
fs.writeFileSync('./env.json', JSON.stringify(process.env, null, 4));