Skip to content

Instantly share code, notes, and snippets.

nrollr /
Last active January 10, 2023 11:55
Install PHP and NGINX on Amazon Linux AMI
## Install NGINX
## when installing on Amazon Linux AMI, use:
$ sudo yum install nginx -y
## when installing on Amazon Linux 2 AMI, use
$ sudo amazon-linux-extras install nginx1.12 -y
## Install PHP and PHP-FPM
# for PHP version 7.1 use php71 and php71-fpm instead
$ sudo yum install php -y
$ sudo yum install php-fpm -y
benorama / .travis.yml
Last active January 10, 2023 18:37
Grails AWS Elastic Beanstalk deployment script
View .travis.yml
language: groovy
jdk: oraclejdk8
sudo: false # To use new Travis docker-based infrastructure
- secure: "..."
- secure: "..."
psayre23 / gist:c30a821239f4818b0709
Last active November 28, 2023 05:13
Runtime Complexity of Java Collections
View gist:c30a821239f4818b0709
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
jdx / boot.js
Last active March 16, 2023 18:08
zero-downtime node.js app runner
View boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
gitaarik /
Last active November 21, 2023 03:45
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
didats / nationality.html
Created December 28, 2013 00:00
Nationality List in HTML Dropdown
View nationality.html
<select name="nationality">
<option value="">-- select one --</option>
<option value="afghan">Afghan</option>
<option value="albanian">Albanian</option>
<option value="algerian">Algerian</option>
<option value="american">American</option>
<option value="andorran">Andorran</option>
<option value="angolan">Angolan</option>
<option value="antiguans">Antiguans</option>
<option value="argentinean">Argentinean</option>
branneman /
Last active November 2, 2023 01:07
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

# taken from
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
asugai / Install composer on Amazon AMI running on EC2
Last active November 7, 2023 21:43
Install composer on Amazon AMI running on EC2
View Install composer on Amazon AMI running on EC2
$ cd ~
$ sudo curl -sS | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
fideloper / sample-app
Created May 15, 2013 20:02
Sample application Upstart script, using Forever
View sample-app
# Sample App Init script for running sample app daemon
# chkconfig: - 98 02
# description: Sample Application Upstart, using Forever