Skip to content

Instantly share code, notes, and snippets.

View przemyslawpluta's full-sized avatar

Przemyslaw Pluta przemyslawpluta

View GitHub Profile
@przemyslawpluta
przemyslawpluta / nginxproxy.md
Last active August 29, 2015 14:27 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/

NFJS Git Workshop

  • Create a repo
    • git config --global user.name "Tim Berglund"
    • git config --global user.email "[email protected]"
    • git config --global color.ui auto
    • git init atlanta
  • Add files
    • Create caesar.txt
    • git add caesar.txt

JAX Git Workshop

Outline

  • git init project
  • git config --global user.name "Tim Berglund"
  • git config --global user.email "[email protected]"
  • git status
  • git add <file>
  • Diff
    • git diff
#!/bin/bash
while :
do
clear
git --no-pager log -$1 --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
sleep 1
done