Skip to content

Instantly share code, notes, and snippets.

View lifeofcoding's full-sized avatar
💭
4RwPdnGala2QfMua

Jimmy Rousseau lifeofcoding

💭
4RwPdnGala2QfMua
View GitHub Profile
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
@lifeofcoding
lifeofcoding / skeleton-daemon.sh
Created September 12, 2018 09:26 — forked from shawnrice/skeleton-daemon.sh
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
@lifeofcoding
lifeofcoding / .eslintrc
Created September 13, 2018 09:40 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@lifeofcoding
lifeofcoding / api.proxy.server.js
Created January 16, 2019 05:01 — forked from davemo/api.proxy.server.js
A simple express.js server with a proxy that intercepts all requests with /api/ and proxies them to localhost:3000
var express = require('express'),
httpProxy = require('http-proxy'),
app = express();
var proxy = new httpProxy.RoutingProxy();
function apiProxy(host, port) {
return function(req, res, next) {
if(req.url.match(new RegExp('^\/api\/'))) {
proxy.proxyRequest(req, res, {host: host, port: port});
@lifeofcoding
lifeofcoding / gist:22fba9e64fb181251a6e884ac9b30045
Created January 16, 2019 05:01 — forked from axefrog/gist:3353609
Node.js HTTP/HTTPS double forward proxy with two-stage authorization
/*
HTTP/HTTPS Forward Proxy
------------------------
The purpose of this proxy is to manage a set of third party proxies
internally, routing incoming requests through those proxies and
rotating which remote proxies are in use periodically as requests come
through, and without exposing the proxy credentials to the originating
client. Rate limiting will later be implemented internally so that if
the remote proxies have all been utilised too heavily, a "rate limit
exceeded" message will be returned to the client.
@lifeofcoding
lifeofcoding / create-react-app-on-heroku.sh
Created May 6, 2019 04:59 — forked from hackur/create-react-app-on-heroku.sh
Create a React app & deploy to Heroku
## Global install of the app generator
npm install -g create-react-app
## Setup the app (first-time only)
create-react-app my-app
cd my-app
git init
# Create the Heroku app; requires free account at https://www.heroku.com/
heroku create -b https://github.com/heroku/heroku-buildpack-static.git
qemu-img convert -O raw source.vhd output.raw
@lifeofcoding
lifeofcoding / handler.js
Created September 4, 2019 11:28 — forked from jeffrafter/handler.js
Simple HTTP Server and Router in node.js
exports.createHandler = function (method) {
return new Handler(method);
}
Handler = function(method) {
this.process = function(req, res) {
params = null;
return method.apply(this, [req, res, params]);
}
}
@lifeofcoding
lifeofcoding / ip.sh
Created April 23, 2020 01:48 — forked from SunDi3yansyah/ip.sh
IP address
#!/bin/bash
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
@lifeofcoding
lifeofcoding / updatenoip.sh
Created April 23, 2020 01:48 — forked from mbierman/updatenoip.sh
Update no IP address
#!/bin/bash
###############################################################
## ChangeIP.com bash update script
###############################################################
## Written 3/18/09 by Tom Rinker, released to the Public Domain
## Re-write 09/15/2017 by Michael Bierman
## I replaced wget with curl so it can work on all macs.
## This works with no-ip.com
###############################################################