Skip to content

Instantly share code, notes, and snippets.

View GabrielMMelo's full-sized avatar

Gabriel Melo GabrielMMelo

View GitHub Profile
@GabrielMMelo
GabrielMMelo / .phoenix.js
Last active September 11, 2021 03:38
Phoenix MacOSX window management config file (aka ~/.phoenix)
Phoenix.set({
daemon: true,
openAtLogin: true
});
/* full screen */
Key.on('f', [ 'ctrl', 'shift' ], function () {
var screen = Screen.main().flippedVisibleFrame();
var window = Window.focused();
@GabrielMMelo
GabrielMMelo / upx_to_open_keygen.txt
Created May 4, 2021 17:46
"You do not have permission to open the application" when trying to open CODE Keygen
## install upx
brew install upx
## expand file
sudo upx -d ~/Desktop/xf-adesk19.app/Contents/MacOS/x-force
## Well done. Just open the file again
@GabrielMMelo
GabrielMMelo / gcs_service.py
Created March 14, 2021 22:40
Common service to operations on GCS
import os
from google.cloud import storage
from dotenv import load_dotenv
from pathlib import Path
class GCPStorage:
def __init__(self):
load_dotenv(dotenv_path='../.env')
self.service_account_path = os.getenv('SERVICE_ACCOUNT_PATH')
<NotepadPlus>
<UserLang name="DAX2" ext="dax" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00-- 01 02 03% 04%</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@GabrielMMelo
GabrielMMelo / days_between_2_dates.sql
Created March 2, 2021 17:54
T-SQL to get all days between two dates (without variables or recursives CTE)
WITH
min_date AS
(
SELECT TOP 1 DATE_FIELD FROM TABLE_XPTO ORDER BY DATE_FIELD ASC
),
max_date AS
(
SELECT TOP 1 DATE_FIELD FROM TABLE_XPTO ORDER BY DATE_FIELD DESC
)
SELECT
@GabrielMMelo
GabrielMMelo / nuget-provider.ps1
Created February 11, 2021 12:52
Update Nuget Provider for Powershell
# answered by Luis Gouveia, Apr 7 '20 at 10:45
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet
@GabrielMMelo
GabrielMMelo / add-commit-template.sh
Last active March 4, 2022 15:57
Template commit following semantic commit pattern
git config --global commit.template ~/.cfg/commit-template
@GabrielMMelo
GabrielMMelo / commit-msg
Created December 19, 2020 23:41
Hook for validating a commit
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)";
commit_regex='((CDW-)([1-9][0-9])|((feat|fix|chore|refactor|style|test|docs)(((\w{0,15})))?))(:.\S.*)';
error_msg="Aborting commit. Your commit message format is invalid, please check the references."
commit_message="$1";
if ! grep -iqE "$commit_regex" <<<"${commit_message}"; then
echo "$error_msg" >&2
exit 1
fi
if [ "$branch" = "master" ]; then
@GabrielMMelo
GabrielMMelo / dotfiles_repo.sh
Created December 19, 2020 16:23
Creating and cloning a dotfiles (bare) repo
# creating
git init --bare $HOME/.cfg
alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
dotfiles config --local status.showUntrackedFiles no
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.bashrc
# cloning
git clone --bare https://github.com/USER_NAME/.dotfiles.git ~/.cfg
@GabrielMMelo
GabrielMMelo / fast_notes_vim.cmd
Last active April 1, 2022 09:28
Batch file for start fast vim notes on Windows
@ECHO OFF
set yy=%date:~6,4%
set mm=%date:~3,2%
set dd=%date:~0,2%
SET today=%dd%-%mm%-%yy%
set hh=%time:~0,2%
set MM=%time:~3,2%
SET now=%hh%:%MM%