server {
listen 80;
listen [::]:80;
server_name *.server1.com;
server_name *.server2.com;
return 301 https://$server_name$request_uri;
}
server {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: `s3publish bucket-name default-profile` | |
# BUCKET to upload to | |
BUCKET=s3://$1 | |
# Optional profile | |
PROFILE=$2 | |
# specify folders if thou so choose | |
ENV=/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function jsEval( jsString ) | |
{ | |
( ( () => {} ).constructor( jsString ) )(); | |
} | |
jsEval( "console.log( 'hello world' );" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// only works for binary numbers 0-15 to help with understanding binary | |
function coerceToBinary( n ) { | |
n = n === +n ? ( n >>> 0 ).toString( 2 ) : n; | |
if( n < 0 ) | |
return coerceToBinary( n ); | |
Set up an HTTPS enabled website with NGINX and LetsEncrypt.
sudo apt-get update
/etc/nginx/sites-available/default
sudo letsencrypt certonly --standalone -n -m [email protected] -d sinopia.exploreplanet3.com --agree-tos
A RAW HISTORY DUMP... SORRY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Desc: Checks if a deep property exists | |
* Exp: checkNested( { a: { b: { c: "d" } } } ); | |
* Returns: Boolean | |
*/ | |
function checkNested( obj ) { | |
const args = Array.prototype.slice.call( arguments, 1 ); | |
for( let i = 0; i < args.length; i++ ) { | |
if( !obj || !obj.hasOwnProperty( args[ i ] ) ) | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReadStream | |
{ | |
constructor( obj, opt = {} ) | |
{ | |
if( Buffer.isBuffer( obj ) || obj === ''+obj ) | |
stream.Readable.call( this, { | |
highWaterMark: opt.highWaterMark, encoding: opt.encoding | |
} ); | |
else | |
stream.Readable.call( this, { objectMode: true } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######### | |
# | |
# Once downloaded, run: `chmod 775 nodeupdate` and double click | |
# | |
######### | |
platform='unknown' | |
case "$OSTYPE" in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
class Time | |
{ | |
constructor( tz ) | |
{ | |
this.tz = tz; | |
this.tzOffset = 3600000 * this.tz || 0; | |
this.days = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ]; | |
this.months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; |