Skip to content

Instantly share code, notes, and snippets.

View gustavomdsantos's full-sized avatar
👨‍💻
Working as an IT manager

Gustavo Moraes gustavomdsantos

👨‍💻
Working as an IT manager
  • Universidade Federal de Goiás
  • Brasília, Distrito Federal
View GitHub Profile
@gustavomdsantos
gustavomdsantos / avd-launcher-get-version_package-manager.sh
Last active December 22, 2015 22:46
[avd-launcher] Trechos de código e de artefatos para uma próxima versão do AVD Launcher https://github.com/gustavosotnas/avd-launcher
#! /bin/bash
# Author: Gustavo Moraes <gustavosotnas1@gmail.com>
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file COPYING in the main directory of this archive
# for more details.
# Script para obter o número da versão do AVD Launcher.
#
@gustavomdsantos
gustavomdsantos / git-rebase_format-branch_examples.sh
Last active February 17, 2017 22:24
Git rebase, format-branch command examples
git rebase -i 1ec6d533d8555bbe72cec3881aba8a4433044a2a # SHA hash do commit "HEAD temporário" (commit anterior ao desejado para modificar!)
git log --format=fuller #Ver todos os commits com todas as informações
# "Commit amending" com mesmo autor (dentro de um "edit" do Rebase)
GIT_COMMITTER_DATE="Mon Apr 20 18:54:39 2015 -0300" git commit --date="Mon Apr 20 18:54:39 2015 -0300" --amend
# "Commit amending" com autor diferente (dentro de um "edit" do Rebase)
GIT_COMMITTER_NAME="Username desejado como exibido no git log" GIT_COMMITTER_EMAIL="email_da@pessoa.com" GIT_COMMITTER_DATE="Fri May 22 00:52:37 2015 -0300" git commit --author="Username desejado como exibido no git log <email_da@pessoa.com>" --date="Fri May 22 00:52:37 2015 -0300" --amend
@gustavomdsantos
gustavomdsantos / Cucumber-Exemplo-SysRadoc.feature
Last active February 25, 2016 19:00
Repositório de exemplos de especificação de requisitos executável - uma funcionalidade do sistema SysRadoc, em linguagem Gherkin, do Cucumber.
#language: pt
# Template de especificação executável em linguagem Gherkin/Cucumber
# Author: Gustavo Moraes <gustavosotnas1@gmail.com>
#
# Artigos sobre a linguagem Gherkin/Cucumber:
# http://elemarjr.net/2012/04/12/bdd-na-prtica-parte-3-gherkin
# http://pt.slideshare.net/edumendes/bdd-com-cucumber-14910137
#
# A ferramenta Cucumber é originalmente feita para Ruby, mas pode usada
@gustavomdsantos
gustavomdsantos / AutoHotKey script for using Media Players in Windows.ahk
Last active May 4, 2017 17:30
AutoHotKey script that remaps F6 - F10 keys on Windows PC keyboard without Media buttons for better use in media players like Spotify. These keys are the same that I use on my Linux Mint notebook, but that OS have a built-in hotkey tweaker. This script doesn't override important Win hotkeys.
; AutoHotKey Beginner Tutorial: https://www.autohotkey.com/docs/Tutorial.htm
; AutoHotKey Key list: https://autohotkey.com/docs/KeyList.htm
; AutoHotKey Hotkeys: https://www.autohotkey.com/docs/Hotkeys.htm
#F9::MEDIA_PLAY_PAUSE
#F10::MEDIA_NEXT
#F6::VOLUME_MUTE
#F7::VOLUME_DOWN
#F8::VOLUME_UP
Return
@gustavomdsantos
gustavomdsantos / .gitignore-for-Android-Studio-projects
Created March 15, 2016 18:37
An adaptation of github/gitignore/Android.gitignore file with '.idea' folder being ignored. To use on your Android Studio project, download and rename it to ".gitignore".
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@gustavomdsantos
gustavomdsantos / [Android] Stop recreating Activity on orientation change _ androidmanifest.xml
Created March 17, 2016 23:42
'androidmanifest.xml' snippet to better support both Landscape and Portrait mode, without recreating activity again. Link: http://stackoverflow.com/a/28718002
<activity
android:configChanges="keyboardHidden|orientation|screenSize"
android:name=".testActivity"
android:label="@string/app_name">
</activity>
@gustavomdsantos
gustavomdsantos / AutoHotKey script for avoid rotating screen.ahk
Last active July 26, 2018 17:31
AutoHotKey script that locks Ctrl+Alt+{Down, Left, Right} keys for avoid rotating Windows screen (90º, 180º, 360º) accidentally, instead of switching virtual desktops (on Windows 10).
; AutoHotKey Beginner Tutorial: https://www.autohotkey.com/docs/Tutorial.htm
; AutoHotKey Key list: https://autohotkey.com/docs/KeyList.htm
; AutoHotKey Hotkeys: https://www.autohotkey.com/docs/Hotkeys.htm
notificationMessage := "Rotação de tela por atalho de teclado bloqueada."
notificationIcon := 16 + 3 ; No notification sound (16) + Error icon (3)
^!Down::
^!Left::
^!Right::
@gustavomdsantos
gustavomdsantos / restore-gitlab-backup-files.sh
Last active May 6, 2016 13:56
Script que ajuda a restaurar backups no GitLab, resolvendo problemas de permissões de arquivos no GitLab, entre outros (comandos obtidos da saída do comando ´sudo gitlab-rake gitlab:check SANITIZE=true` e http://doc.gitlab.com/ce/raketasks/backup_restore.html#omnibus-installations)
#! /bin/bash
APP_NAME="Restore GitLab Backup Files by gustavosotnas"
# Author: Gustavo Moraes <gustavosotnas@gmail.com>
#
# Solution based in GitLab's official tutorial to restore backups:
# http://doc.gitlab.com/ce/raketasks/backup_restore.html#omnibus-installations
# (This script applies to GitLab installations from official .deb package!)
#
# To backup a GitLab repository server, simply run this command:
@gustavomdsantos
gustavomdsantos / ReadFileToString.java
Last active May 11, 2016 00:20
The simplest way to read a file to String in Java, based on http://stackoverflow.com/a/3403112
private static String readFile(String filename) throws FileNotFoundException {
return new Scanner(new File(filename)).useDelimiter("\\Z").next();
}
@gustavomdsantos
gustavomdsantos / detectPyVersion.py
Created May 12, 2016 11:48
Um código para Python 3+ de exemplo com codificação UTF-8 e mensagem que detecta versão do Python.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
if sys.version_info[0] < 3:
print ("Está usando Python 2 né? Atualiza logo!")
else:
print ("Está usando Python 3, bom...")