Skip to content

Instantly share code, notes, and snippets.

View rcanepa's full-sized avatar

Renzo Canepa rcanepa

  • Santiago, Chile
View GitHub Profile
@rcanepa
rcanepa / Commit Formatting.md
Created May 18, 2017 16:31 — forked from clemtibs/Commit Formatting.md
Angular Commit Format Reference Sheet

Git Commit Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the AngularJS change log.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

@rcanepa
rcanepa / routes.js
Last active March 2, 2023 08:29
Private routes with React Router v4
function PrivateRoute ({component: Component, authenticated, ...rest}) {
return (
<Route
{...rest}
render={(props) => authenticated === true
? <Component {...props} />
: <Redirect to={{pathname: '/login', state: {from: props.location}}} />}
/>
)
}
@rcanepa
rcanepa / lmdb.tcl
Created April 28, 2017 16:36 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
# Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}
server {
@rcanepa
rcanepa / gist:0b9beaac137f7d45754b58822bfd0092
Created January 30, 2017 22:58
Nginx conf file example (with gzip compression)
user nginx nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
00 01 10 11
00000 NUL Spc @ `
00001 SOH ! A a
00010 STX " B b
00011 ETX # C c
00100 EOT $ D d
00101 ENQ % E e
00110 ACK & F f
00111 BEL ' G g
01000 BS ( H h
@rcanepa
rcanepa / gist:2b63d68fe2818d707766e8e53c5c4049
Created January 9, 2017 00:06
List of processes listening on TCP ports (OSX)
sudo lsof -i -n -P | grep TCP
Google 10688 rcanepa 397u IPv4 0xdd1115e7bbd6242d 0t0 TCP 192.168.1.85:62303->13.23.133.39:80 (ESTABLISHED)
Google 10688 rcanepa 400u IPv4 0xdd1115e7bbd61b35 0t0 TCP 192.168.1.85:62305->162.242.212.19:443 (ESTABLISHED)
Emacs 34962 rcanepa 20u IPv4 0xdd1115e7a6fb104d 0t0 TCP 127.0.0.1:59494->127.0.0.1:59492 (ESTABLISHED)
Emacs 34962 rcanepa 21u IPv4 0xdd1115e79dac804d 0t0 TCP 127.0.0.1:59496->127.0.0.1:59492 (ESTABLISHED)
java 35292 rcanepa 86u IPv6 0xdd1115e7a5c0fc95 0t0 TCP 127.0.0.1:59492 (LISTEN)
java 35292 rcanepa 87u IPv6 0xdd1115e79ab371d5 0t0 TCP 127.0.0.1:59492->127.0.0.1:59494 (ESTABLISHED)
java 35292 rcanepa 88u IPv6 0xdd1115e79c7bd715 0t0 TCP 127.0.0.1:59492->127.0.0.1:59496 (ESTABLISHED)
java 35292 rcanepa 103u IPv6 0xdd1115e79c7bd1d5 0t0 TCP *:3449 (LISTEN)
- To rename a data type:
ALTER TYPE electronic_mail RENAME TO email;
- To change the owner of the type email to joe:
ALTER TYPE email OWNER TO joe;
- To change the schema of the type email to customers:
@rcanepa
rcanepa / gist:4ca0bef7e4a36a6cb975bb4b7a412e23
Created December 29, 2016 02:12
ARP and nmap to scan a network
Get broadcast IP
$ ifconfig | grep broadcast
Ping the IP
$ ping broadcast
Check the ARP table
$ arp -a
ARP will only list address that are on the same subnet as your computer.
@rcanepa
rcanepa / nginxproxy.md
Created December 24, 2016 14:44 — 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