Skip to content

Instantly share code, notes, and snippets.

@essamalsaloum
essamalsaloum / docker-help.md
Created October 24, 2018 21:27 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@essamalsaloum
essamalsaloum / myscript.sh
Created July 8, 2018 03:16 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@essamalsaloum
essamalsaloum / nginx.conf
Created April 28, 2018 12:47 — forked from mojaray2k/nginx.conf
NGINX Multiple Server Block file to serve multiple Node Applications on Multiple Domains on A GoDaddy Dedicated Server
# 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 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
@essamalsaloum
essamalsaloum / postgres_queries_and_commands.sql
Created April 16, 2018 14:03 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@essamalsaloum
essamalsaloum / postgres-cheatsheet.md
Created February 2, 2018 23:42 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@essamalsaloum
essamalsaloum / flightplan-deploy.md
Created November 6, 2017 03:53 — forked from learncodeacademy/flightplan-deploy.md
Deploy Node.js Apps with Flightplan

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
class Observable {
constructor(subscriber) {
this.subscriber = subscriber
}
subscribe(observer) {
if (typeof observer == 'function') observer = {next: observer}
if (!observer.next) observer.next = () => {}
if (!observer.complete) observer.complete = () => {}
function Observable(init_value) {
var _value = init_value;
var subscriber = [];
function obs() {
if (arguments.length) {
_value = arguments[0];
obs.trigger();
return this;
} else {
@essamalsaloum
essamalsaloum / three-table-join.sql
Created September 15, 2017 15:41 — forked from rts-rob/three-table-join.sql
Example of an INNER JOIN across three tables
CREATE VIEW ClassesAndRunningInformation AS
SELECT
ClassGroup.Name AS ClassGroupName,
Running.StartDate,
Module.Name AS ModuleName,
Module.Length AS ModuleLength
FROM
ClassGroup
INNER JOIN
Running