Skip to content

Instantly share code, notes, and snippets.

View gcaraciolo's full-sized avatar
🏠
Working from home

Guilherme Caraciolo gcaraciolo

🏠
Working from home
View GitHub Profile
@gcaraciolo
gcaraciolo / api.postgrain.local
Created February 12, 2019 01:38
Postgrain - Localhost MacOS
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /usr/local/etc/nginx/ssl/nginx-selfsigned.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/nginx-selfsigned.key;
index index.php index.html;
@gcaraciolo
gcaraciolo / form.ts
Last active January 6, 2018 13:28
Angular 5 Form approach for edit/new cases - Address example
export abstract class Form {
protected abstract finishSubmit();
protected abstract form();
protected abstract createForm();
}
download the key pair (key.pem) from aws
change its mode
$ chmod 400 key.pem
add it to ssh permanently to ssh store using *ssh-add* command
$ ssh-add key.pem
access the machine with ssh.
$ ssh ubuntu@xxx.xxx.xxx.xxx
@gcaraciolo
gcaraciolo / nginx.conf
Created February 20, 2017 18:49
Nginx, simple secure server, http and rtmp only local network
worker_processes 1;
error_log logs/rtmp_error.log debug;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
{
"env":{
"browser": true,
"node": true
},
"globals":{
"jQuery":true,
"moment":true,
"appServices":true,
var startAt = '2016-08-09';
var id = 1;
Model.find({
where: {
$and: [
{
id: id
},
sequelize.where(
@gcaraciolo
gcaraciolo / daemon stript
Last active September 23, 2016 19:53
Install nightmare ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":99 -screen 0 1024x768x24 -fbdir /var/run -ac"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@gcaraciolo
gcaraciolo / postgres_queries_and_commands.sql
Created September 8, 2016 18:54 — 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%'
@gcaraciolo
gcaraciolo / deployUser.md
Created January 12, 2016 17:51 — forked from learncodeacademy/deployUser.md
Adding a deploy user in Linux

(wherever it says url.com, use your server's domain or IP)

Login to new server as root, then add a deploy user

sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy

And Update the new password

@gcaraciolo
gcaraciolo / debuglog_macro.h
Last active September 18, 2015 02:01 — forked from alanthonyc/debuglog_macro.h
Debug Log Macro for iOS (pulled from zonque's code)
#ifdef ENABLE_DEBUG
#define DebugLog(format, args...) \
NSLog(@"%s, line %d: " format "\n", \
__func__, __LINE__, ## args);
#else
#define DebugLog(format, args...) do {} while(0)
#endif
// sample use
DebugLog("number: %d ; class %p", count, className);