Skip to content

Instantly share code, notes, and snippets.

View MMachado-uy's full-sized avatar
💭
this is false

Mauricio Machado MMachado-uy

💭
this is false
View GitHub Profile

Pretty print git logs in one line Optionally, add -<number> to increase the log reach

$ git config --global alias.lg 'log --format="%C(auto)%h %Cgreen%s %Creset(%cN, %cr) %C(auto)%d" -10'

Show diff in commits between two branches Use as $ git branch-diff <branch1>..<branch2> Add the --reverse flag to show the log in "GitHub order"

@MMachado-uy
MMachado-uy / git-back
Last active October 15, 2019 16:50
Go to a branch, do stuff and git back to where you were
#!/bin/bash
# Add this file with run permissions in a PATH-visible folder
# Run it from a repository with `git back` to go back to the previous branch
prev=$(git describe --all $(git rev-parse @{-1}) | sed 's/heads\///g')
git checkout $prev
@MMachado-uy
MMachado-uy / setup.sh
Last active August 20, 2019 21:57
Entry point for the Ubuntu Setup project. Lots of personal settings, not necessarily what you need/want, but it's a jump-start.
#!/bin/bash
# Entry point for the UbuntuSetup Repo:
# github.com/MMachado-uy/ubuntuSetup
#
# Save this file in your computer and give it
# execute privileges with $ chmod +x setup.sh
#
# WARNING: This script and the scripts it calls
# uses sudo to install and set up software in
# the host machine. Use with caution.
#!/bin/sh
sudo apt update
sudo apt upgrade
sudo apt install -y git php nodejs terminator curl apt-transport-https ca-certificates software-properties-common composer docker-compose mysql-server mysql-workbench fortunes fortunes-debian-hints fortunes-mario
# Sublime Text
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
@MMachado-uy
MMachado-uy / git-deliver
Created October 4, 2018 19:49
Tired of typing git push origin some-ugly-branch-name-with-ticket-number-and-project-reference? Just git deliver it
#!/bin/bash
# Save in a PATH-seen folder and it should be ready to go in git as git deliver
# Pushes your current changes to origin/same-as-current-branch
branch=$(git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/\1/p')
git push origin $branch
[Desktop Entry]
Version=1.0
Name=Telegram Desktop
Comment=Official desktop application for the Telegram messaging service
TryExec=/home/mauricio/.bin/Telegram/Telegram
Exec=/home/mauricio/.bin/Telegram/Telegram -- %u
Icon=telegram
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
@MMachado-uy
MMachado-uy / Preferences.sublime-settings.json
Last active May 29, 2018 14:48
Sublime Text preferences
{
"always_show_minimap_viewport": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"font_size": 10,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"indent_guide_options":
@MMachado-uy
MMachado-uy / prune-repo
Last active September 3, 2019 15:51
Remove all unwanted git branches
#!/bin/bash
# Installation:
# Linux:
# > Save it in a PATH folder
# > Give execution permission to this file
# > Run from the terminal as prune-repo [options]
# Windows:
# > Save it in a PATH folder
# > Rename to git-prune-repo
# > Run from the terminal as git prune-repo [options]
@MMachado-uy
MMachado-uy / git-stache
Last active April 15, 2018 13:36
Add style (and hours of dad-puns) to your boring git stash with this gorgeous and well trimmed git-stache
#!/bin/bash
# Add the location of this file to your path and then simply call
# git stache instead of your regular and dull git stash. Batteries not included.
_sleep() {
sleep 0.1
}
if [ -d .git ]; then
_sleep && echo ''
@MMachado-uy
MMachado-uy / .bashrc
Last active September 25, 2019 01:00
Personal .bashrc setup (Lots of stolen stuff and useless why-not(s))
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac