Skip to content

Instantly share code, notes, and snippets.

View dgmike's full-sized avatar

Michael dgmike

View GitHub Profile
@dgmike
dgmike / Migrations thinking.md
Last active November 18, 2021 12:09
Migrations thinking

Looking a post from serokell about elixir's library called ecto.

In the post he presents an migration:

defmodule Blog.Repo.Migrations.Initial do
  use Ecto.Migration

  def change do
    create table ("users") do
@dgmike
dgmike / cloner.sh
Last active October 20, 2021 11:45
Clone all repos from github
#!/bin/bash
# Set CNTX=users and NAME=yourusername, to download all your repositories.
# Set CNTX=orgs and NAME=yourorgname, to download all repositories of your organization.
CNTX={users|orgs} NAME={username|orgname} PAGE=1 \
curl -s "https://api.github.com/$CNTX/$NAME/repos?page=$PAGE&per_page=100" |
jq -r '.[]|.ssh_url' |
xargs -L1 -n1 -t git clone
@dgmike
dgmike / portainer.sh
Created May 22, 2018 00:19
Running portainer on your machinne
#!/bin/bash
docker volume create portainer_data
docker run -d -p 9100:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
@dgmike
dgmike / corporate-groups-api__docker-compose.yml
Created June 28, 2017 16:58
Use docker-compose with extends
version: "2"
services:
app:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- ./src:/app
ports:
@dgmike
dgmike / canalize.sh
Last active February 24, 2017 20:10
Run codeclimate only on files that differs from another branch
function changed_files {
local BASE_BRANCH=$*
git diff --name-only ${BASE_BRANCH:="origin/staging"} | grep -v Gemfile | grep -v .codeclimate | grep -v db/schema.rb | tr "\n" " "
}
function canalyze {
codeclimate analyze $(changed_files) $*
}
#!/usr/bin/env ruby
### Put this file in any $PATH of your system aka /usr/local/bin and run as follow
### $ git pivotal_checkout 139473593
### + git checkout -b bug/139473593-nome-da-task-do-pivotal
ENV['PIVOTAL_TOKEN'] = 'XXXXXXXXXXXX'
ENV['PROJECT_ID'] = 'XXXXXXXXX'
##### /PivotalApiLib
@dgmike
dgmike / watch_rspec.sh
Created February 3, 2017 21:22
Watch some paths and run rspec with defined arguments
# Watch some path and run rspec with defined arguments
#
# usage:
# watch_rspec watch_path1 watch_path2 -- rspec_arguments
#
function watch_rspec
{
local WATCH_FILES
local ARGUMENTS
@dgmike
dgmike / README.md
Last active January 6, 2017 12:49
Comando embutido no git para criar merges para homolog baseado no staging

Como instalar

  • Crie um arquivo chamado git-homolog e coloque-o em uma pasta do seu $PATH.

No meu $HOME/.bashrc eu tenho a seguinte instrução

if [[ -d "$HOME/.bin" ]]; then
 PATH=$HOME/.bin:$PATH
@dgmike
dgmike / Gemfile
Last active December 21, 2016 13:22
put this in your Gemfile, from redmine ;-)
# load Gemfile.local if it exists
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
eval_gemfile local_gemfile if File.exists?(local_gemfile)
# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file|
eval_gemfile file
end
require 'json'
package = JSON.parse(File.read 'package.json')
version = `stepup version --next-release`.strip
package['version'] = version
puts JSON.generate package, indent: " ", space: " ", object_nl: "\n", array_nl: "\n", max_nesting: false