server {
listen 80;
listen [::]:80;
server_name *.server1.com;
server_name *.server2.com;
return 301 https://$server_name$request_uri;
}
server {
This file contains 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'; | |
/** | |
* @typedef {number} milliseconds | |
* @description | |
* A number assumed to be in milliseconds.<br/> | |
* Number is likely to be calculated against a Unix Epoch based timestamp or milliseconds since Jan 01 1970.<br/> | |
* When multiplied by <code>1e-3</code>, number should convert to seconds | |
*/ |
Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors
This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.
One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.
An alternative version of this design automatically invokes the base constructor in most situations.
This file contains 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
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
int w = 0; | |
for( int x = 0; x < 100; x++ ) { | |
for( int y = 0; y < 100; y++ ) { | |
for( int z = 0; z < 100; z++ ) { | |
w += z; | |
} |
chmod 400 key.pem
ssh -i "nick-aws-key.pem" ubuntu@ec2-public-dns.compute-1.amazonaws.com
sudo apt-get upgrade
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
sudo apt-get install awscli
sudo vi /etc/ssh/sshd_config
PasswordAuthentication no
=>PasswordAuthentication yes
This file contains 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 | |
sudo xcodebuild -license | |
echo " | |
alias ll='ls -lGaf' | |
" >> ~/.bash_profile | |
sudo npm i -g pm2 |
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 nick@exploreplanet3.com -d sinopia.exploreplanet3.com --agree-tos
A RAW HISTORY DUMP... SORRY
This file contains 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 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 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; |