Skip to content

Instantly share code, notes, and snippets.

View Jamp's full-sized avatar

Jaro Marval Jamp

View GitHub Profile
@Jamp
Jamp / gunicorn.service
Created June 24, 2017 23:29
Gunicorn Systemd Config
[Unit]
Description=gunicorn daemon
After=network.target
After=syslog.target
[Service]
User=nginx
Group=nginx
EnvironmentFile=/etc/api.gunicorn
WorkingDirectory=/var/webapps/api
@Jamp
Jamp / Config PyCharm
Created January 24, 2018 04:44
Configure for pycharm auto compile sass
First "gem install sass" on console
Go Menu File > Settings > Tools > File Watch > "+" > "sass"
On New Window > Section Watcher Settings
Program: /<home-directory>/.gem/ruby/2.5.0/bin/sass
Arguments: --no-cache --update --no-cache --update $FileName$:../css/$FileNameWithoutExtension$.css --style compressed
Compile sass file on folder css on file minified
@Jamp
Jamp / querys.js
Created February 15, 2018 20:40
Consultas optimizadas para los tweets en mongodb
db.tweets.aggregate(
{
$project: {
y: { $year: "$created_at"},
m: { $month: "$created_at"},
d: { $dayOfMonth: "$created_at"},
h: { $hour: "$created_at"},
tweet: 1
}
},
@Jamp
Jamp / Dockerfile
Last active April 16, 2018 22:44
Dockerfile para construir aplicaciones VueJS
FROM node:8.9.4-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY ./src/package.json /usr/src/app
RUN yarn
COPY ./src/. /usr/src/app/
RUN yarn global add http-server
@Jamp
Jamp / .bashrc
Created May 26, 2018 14:35
Keep without password ssh key for one session
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
(umask 066; /usr/bin/ssh-agent > "${SSH_ENV}")
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add -t 36000; # Lifetime only for 10 hours
}
# Source SSH settings, if applicable
@Jamp
Jamp / default.conf
Created June 26, 2018 02:02
Configuración para Nginx + Webapp + API Express + SocketIO
upstream spa {
server webapp:2000;
}
upstream api {
server api:3000;
}
server {
@Jamp
Jamp / cotizaciones.php
Created February 13, 2019 00:41 — forked from jtechera/cotizaciones.php
Cotizacion de monedas y U.I. desde el BCU (Uruguay)
<?php
function getCotizaciones($monedas = true)
{
$url = 'https://www.bcu.gub.uy/_layouts/BCU.Cotizaciones/handler/CotizacionesHandler.ashx?op=getcotizaciones';
$data = "";
$last_date_found = false;
$diff = 1;
$cotizaciones = array();
$codigosAceptados = array("USD", "EURO", "CHF", "GBP", "ARS", "BRL", "JPY", "U.I.");
@Jamp
Jamp / slugify.php
Created April 22, 2019 20:58
Slugify Texto
function slugify($text) {
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
$text = preg_replace('~[^-\w]+~', '', $text);
$text = preg_replace('~-+~', '-', $text);
$text = trim($text, '-');
$text = strtolower($text);
if (empty($text)) {
return 'n-a';
}
@Jamp
Jamp / node-app.service
Created May 20, 2019 18:00
Systemd config for NodeJS App
[Unit]
Description=Application NodeJS
# Requires the mysql service to run first
Requires=After=mysql.service
[Service]
ExecStart=/usr/bin/node /app/main.js
# Required on some systems
@Jamp
Jamp / nodejs-app.conf
Created May 20, 2019 18:03
Nginx Proxy Reverse for NodeJS App with SSL Letsencrypt
upstream nodejs-app {
server 127.0.0.1:3000;
keepalive 64;
}
# Server on port 80
server {
listen 80;
server_name app.nodejs.com;
root /app;