Skip to content

Instantly share code, notes, and snippets.

View catogonzalez's full-sized avatar

Carlos Gonzalez catogonzalez

  • Bogota, Colombia
View GitHub Profile
@catogonzalez
catogonzalez / post-checkout
Created August 15, 2019 23:00
Git hooks to automate database snapshots using Stellar
#!/bin/sh
# This is to automate the process of db snapshots with
# https://github.com/fastmonkeys/stellar
# read current git branch name
BRANCH=$(git rev-parse --abbrev-ref HEAD )
if stellar list | grep $BRANCH; then
# checkout the existing db snapshot
stellar restore $BRANCH
@catogonzalez
catogonzalez / Rails Console time travel
Created March 2, 2022 19:17 — forked from signaes/Rails Console time travel
Using active support time helpers to change the current date in the rails console
require 'active_support/testing/time_helpers'
# the class below could have any name
class Tempo
include ActiveSupport::Testing::TimeHelpers
end
# any desidered date
desired_date = Date.today - 2.days
@catogonzalez
catogonzalez / iterm2-solarized.md
Created June 18, 2022 14:51 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@catogonzalez
catogonzalez / authentication.py
Created July 19, 2022 15:55 — forked from WayneSan/authentication.py
PyJWT + Django REST framework 2
import jwt
from django.conf import settings
from django.contrib.auth.models import User
from rest_framework import exceptions
from rest_framework.authentication import TokenAuthentication
class JSONWebTokenAuthentication(TokenAuthentication):
@catogonzalez
catogonzalez / heroku-remote.md
Created September 30, 2022 17:31 — forked from randallreedjr/heroku-remote.md
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@catogonzalez
catogonzalez / 0fixup.md
Created December 16, 2022 12:41 — forked from silent1mezzo/0fixup.md
On undoing, fixing, or removing commits in git

A git choose-your-own-adventure!

This document is an attempt to be a fairly comprehensive guide to recovering from what you did not mean to do when using git. It isn't that git is so complicated that you need a large document to take care or your particular problem, it is more that the set of things that you might have done is so large that different techniques are needed depending on exactly what you have done and what you want to have happen.

@catogonzalez
catogonzalez / migrations.md
Created April 4, 2023 14:43 — forked from majackson/migrations.md
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
@catogonzalez
catogonzalez / homebrew-permissions-issue.md
Created May 22, 2023 22:19 — forked from irazasyed/homebrew-permissions-issue.md
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*