Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Patricio López Juri lopezjurip

🎯
Focusing
View GitHub Profile
@lopezjurip
lopezjurip / script.sh
Created Sep 25, 2016
Github full code review
View script.sh
# Create empty branch.
git checkout --orphan review
git rm -rf .
git commit --allow-empty -m "Create empty branch"
git push --set-upstream origin review
# Create `project` branch from `master` current state.
git checkout -b project
git merge master --allow-unrelated-histories
git push --set-upstream origin project
@lopezjurip
lopezjurip / Caddyfile
Last active Nov 17, 2021
Fix Too Many Redirect error using Caddy + Cloudflare
View Caddyfile
www.mysite.com, mysite.com {
proxy / webapp:3000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
gzip
tls your@email.com
}
@lopezjurip
lopezjurip / chocolatey-git-python3.md
Last active Oct 13, 2021
Install Chocolatey on Windows 10 | Install git and Python3 (with pip)
View chocolatey-git-python3.md

Install Chocolatey on Windows 10

First, you have to run Powershell as administrator. Then type the following:

Set-ExecutionPolicy Unrestricted

Accept to continue.

Then we install Chocolatey:

@lopezjurip
lopezjurip / gist:cd92f879bc92af698f85ad0433a953cd
Created Mar 29, 2021
Migrate Postgres string field to integer if present else null
View gist:cd92f879bc92af698f85ad0433a953cd
ALTER TABLE "public"."usage_stats"
ALTER COLUMN "resSize" TYPE INT USING CASE WHEN "resSize" ~ '^[-+0-9]+$' THEN "resSize"::integer ELSE NULL END;
@lopezjurip
lopezjurip / CSharp.sublime-build
Created May 30, 2015
Sublime Text 3 - C# Build System
View CSharp.sublime-build
{
"shell": true,
"cmd": ["mcs $file ; mono $file_base_name.exe"],
"selector": "source.cs"
}
@lopezjurip
lopezjurip / App.tsx
Created Dec 30, 2020
React useReducer useContext with Typescript types
View App.tsx
import React, { useReducer, useContext, Dispatch } from "react";
import "./styles.css";
// Local types, example: box, product, venue, etc
type MyItem = {
id: number;
name: string;
};
// Reducer types
@lopezjurip
lopezjurip / gist:c509eadf1e31b45825a9
Created Feb 10, 2015
Create Doorkeeper authorization via rails console
View gist:c509eadf1e31b45825a9
app = Doorkeeper::Application.create!(:name => 'myapp', :redirect_uri => 'myapp://oauth/callback')
@lopezjurip
lopezjurip / gist:a817e96ec833e7667274
Last active Jun 9, 2020
DigitalOcean+Rails+Puma+Dokku+Postgress
View gist:a817e96ec833e7667274
# Based on: http://donpottinger.net/blog/2014/11/17/bye-bye-heroku-hello-dokku.html
# Add to gemfile:
ruby '2.1.2'
gem 'pg'
gem 'puma'
gem 'rails_12factor'
gem 'searchkick'
gem 'typhoeus'
@lopezjurip
lopezjurip / Dockerfile
Last active May 28, 2020
A great Dockerfile for Node.js with Typescript and Yarn (multi-step build) and NPM Token for private modules
View Dockerfile
##
# First stage: prepare image
FROM node:12-alpine AS base
ARG NPM_TOKEN
ARG WORKDIR=/usr/src/app
WORKDIR ${WORKDIR}
# Install container build dependencies
RUN apk --no-cache add g++ ca-certificates lz4-dev musl-dev openssl-dev \
make python gcc zlib-dev libc-dev bsd-compat-headers py-setuptools git bash
@lopezjurip
lopezjurip / gitlab-ci.yml
Created May 23, 2020
pipenv, zappa and Gitlab CI
View gitlab-ci.yml
image: python:latest
stages:
- deploy
variables:
WORKON_HOME: .pipenv/venvs
PIP_CACHE_DIR: .pipenv/pipcache
cache: