Skip to content

Instantly share code, notes, and snippets.

View wrannaman's full-sized avatar

Andrew Pierno wrannaman

View GitHub Profile
@wrannaman
wrannaman / MASM 1
Created June 2, 2015 15:05
Basic x86 MASM program that does simple sum, difference, product, I/0 stuff
TITLE Programming Assignment #1 (Project01.asm)
; Author: Andrew Pierno
;
; Description: Write and test a MASM program to perform the following tasks:
; 1. Display your name and program title on the output screen.
; 2. Display instructions for the user.
; 3. Prompt the user to enter two numbers.
; 4. Calculate the sum, difference, product, (integer) quotient and remainder of the numbers.
; 5. Display a terminating message.
@wrannaman
wrannaman / Debounce
Last active August 29, 2015 14:22
Useful JS Helper Functions
// Try with scroll, resize, key up/down/etc
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
Vivus.js
snapsvg.io
d3js.org
@wrannaman
wrannaman / sails www refresh
Last active August 29, 2015 14:25
getting sick of stopping your server and hitting sails www when adding new files? Bash to the rescue. Put this in your root folder and run it : $./autorun 60 sudo sails www
#!/bin/bash
#usage ./autorun 60 sudo sails www
function show_help()
{
echo ""
echo "usage: watch [sleep duration in seconds] [command]"
echo ""
echo "e.g. To cat a file every second, run the following"
echo ""
// check for existing keys
ls -al ~/.ssh
// generate keys
ssh-keygen -t rsa -b 4096 -C "andrewpierno@gmail.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
// config
- sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 8001
- sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to 8000
- sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8001
- sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8000
## Redis
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
make test
redis also wanted:
sudo su
#nginx
sudo yum groupinstall 'Development Tools'
sudo yum install pcre-devel
### something like
wget http://nginx.org/download/nginx-1.8.0.tar.gz?_ga=1.266525902.1751854525.1458831032
tar -xf nginx-1.8.0.tar.gz
mv nginx-1.8.0 /etc/nginx
cd /etc/nginx
./configure
@wrannaman
wrannaman / nginx.conf
Created July 7, 2016 16:41
sample nginx.conf file with subdomain for blog.domain.com and least connected and ssl
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
@wrannaman
wrannaman / LEtsEncrypt
Last active April 26, 2017 15:08
lets encrypt on amazon linux ami with nginx
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
.certbot-auto certonly --standalone -d example.com -d www.example.com
## Haven't done the auto renew yet. but it seems to work ...
.certbot-auto renew --quiet --no-self-upgrade
If you're doing sub domains it doesnt like the www.sub.domain.com it just wants sub.domain.com
sudo letsencrypt certonly --text --agree-tos --email hello@email.com -d auth.yourapp.com -d app.yourapp.com