Skip to content

Instantly share code, notes, and snippets.

View marcelosantos's full-sized avatar

Marcelo Santos marcelosantos

View GitHub Profile
@marcelosantos
marcelosantos / gist:de5545f67654cc90d2d1f22b3ed40d62
Created November 16, 2018 16:43 — forked from CrookedNumber/gist:8964442
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@marcelosantos
marcelosantos / Telegram-accents-bug.md
Last active August 21, 2018 13:55
When you are with graphic accents problems on Telegram running over Ubuntu like!

When you are with graphic accents problems on Telegram running over Ubuntu distro you can try fix it like this:

Editing the file telegramdesktop.desktop located at

/home/(your_username)/.local/share/applications/

and changing the following line in it:

Exec=/home/(your_username)/Downloads/Telegram/Telegram -- %u

@marcelosantos
marcelosantos / Gruntfile.js
Created April 27, 2018 12:40 — forked from edderrd/Gruntfile.js
Sample laravel grunt file
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
less: {
development: {
options: {
paths: ["public/assets/less/*.less"]
}
}
},

Fix problems bower

git config --global url."https://".insteadOf git://

bower/bower#467

@marcelosantos
marcelosantos / configurando.webhook.autodeploy.md
Created October 18, 2017 19:20 — forked from samirfor/configurando.webhook.autodeploy.md
Configurando Webhook para Autodeploy no GitLab

Configurando Webhook para Autodeploy no GitLab

  1. Crie uma pasta no /var/www/ chamada .ssh.
 mkdir -p /var/www/.ssh
  1. Crie uma chave para o usuário www-data.
@marcelosantos
marcelosantos / mysql.txt
Created October 9, 2017 17:33 — forked from johnantoni/mysql.txt
mysql + vagrant + remote access
username: vagrant
password: vagrant
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client
sudo nano /etc/mysql/my.cnf

Get a date of next day with Ruby

require 'date'

def date_of_next(day_name)
  date  = Date.parse(day_name)
  delta = date > Date.today ? 0 : 7
  date + delta
end
@marcelosantos
marcelosantos / Removing-File-From-Commit.md
Last active June 14, 2017 15:44
Removing a specific file from a commit

This is a git command to remove an specific file from a commit

$ git checkout HEAD~ path/to/file

$ git commit --amend

@marcelosantos
marcelosantos / Using-Gemsets-Ruby.md
Last active June 3, 2017 21:53
This is an simples step-by-step with some commands to use GEMSET on Ruby ENVIROMENTS

Using gemset to development with Ruby enviroments

Creating an gemset ENV

$ rvm gemset create GEMSET_NAME

Using an gemset ENV

$ rvm gemset use GEMSET_NAME

Deleting an gemset ENV

$ rvm gemset delete GEMSET_NAME

@marcelosantos
marcelosantos / upgrade-postgres-9.3-to-9.5.md
Created June 2, 2017 11:21 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main