Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#
# Originally from https://gist.github.com/IanVaughan/2902499
#
# authors: Ian Vaughan
# Jacob Zimmerman
#
# usage: uninstall_gems [<version> ...]
#
# examples:
@marciol
marciol / audit_log_purge_test.exs
Last active May 3, 2019 23:42
How to purge rows from tables to s3 from a Elixir application using Ports - audit_log_purge_test.exs
defmodule Mix.Tasks.AuditLogPurgeTest do
use RkOneApi.DataCase
import Ecto.Query
import Ecto.Changeset
alias MyApp.AuditLog
alias Mix.Tasks.AuditLogPurge
defp build_fake_backup_cmd(_, _, _), do: "cat"
@marciol
marciol / audit_log_purge.ex
Last active May 3, 2019 23:38
How to purge rows from tables to s3 from a Elixir application using Ports - audit_log_purge.ex
defmodule Mix.Tasks.AuditLogPurge do
use Mix.Task
alias MyApp.Repo
alias MyApp.AuditLog
def run(argv, backup_cmd \\ &build_backup_cmd/3) do
Mix.EctoSQL.ensure_started(Repo, [])
{options, _argv} =
OptionParser.parse!(
argv,
strict: [
@marciol
marciol / README.md
Last active November 6, 2018 13:27
Exemplos de uso do rpay.js

Rakuten Pay: Exemplos de formulários de tokenização e fingerprint

Aqui estão exemplos de como utilizar a API de tokenização e geração de fingerprint do Rakuten Pay.

@marciol
marciol / psql-with-gzip-cheatsheet.sh
Created October 30, 2018 20:23 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@marciol
marciol / vim_remove_unicode
Created June 16, 2017 19:39
VIM - Remove zero-width spaces
# Remove zero-width spaces
:%s/\%u200b//g
@marciol
marciol / vim_remove_unicode
Created June 16, 2017 19:39
VIM - Remove zero-width spaces
# Remove zero-width spaces
:%s/\%u200b//g
@marciol
marciol / second.erl
Created February 26, 2017 02:29
Functional Erlang Mooc
-module(second).
-export([hypotenuse/2, perimeter/2]).
hypotenuse(A, B) ->
AA = first:square(A),
BB = first:square(B),
math:sqrt(AA + BB).
perimeter(A, B) ->
C = hypotenuse(A, B),
@marciol
marciol / config.ex
Created February 22, 2017 18:08 — forked from bitwalker/config.ex
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.