Skip to content

Instantly share code, notes, and snippets.

View roalcantara's full-sized avatar
🤖
Don't Panic!

Rogério Rodrigues de Alcântara roalcantara

🤖
Don't Panic!
View GitHub Profile
@roalcantara
roalcantara / lua_5_4.md
Created February 28, 2021 02:46
Lua 5.4 - Cheat Sheet

Lua - Beginners Guide

Printing

print("Hello World")

Comments

--this is a comment
@roalcantara
roalcantara / git.sh
Last active April 23, 2024 18:56
Git commands
# to log oneliner
git log --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# to log oneliner 2
git log --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit --date=iso-strict
# to change a specific commit
git rebase -i <HASH>
# to abort the rebase
@roalcantara
roalcantara / XDG.cheat-sheet.md
Last active April 10, 2024 21:56
XDG cheat sheet

XDG - Base Directory Specification

Directories

Base

The intended use-case for BaseDirectories is to query the paths of user-invisible standard directories that have been defined according to the conventions of the operating system the library is running on.

@roalcantara
roalcantara / sub_query.groovy
Last active March 1, 2024 16:49
Grails: Criteria + Subquery (DetachedCriteria)
/*
Suppose we need a query searching for all Equipments that are not being used in any ServiceOrder.
It means, given the following query:
select this_.*
from equipment this_
where this_.status == 'enabled'
and not exists (select so_.id as y0_ from service_order so_ where (so_.equipment_id=this_.id))
order by this_.serial_number asc;
@roalcantara
roalcantara / git-aliases.ini
Created February 8, 2024 02:56
Useful git aliases
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-alias
[alias]
# Add files to the staging area
# @example: git a
a=add
# Add all files to the staging area
# @example: git aa
aa=add --all
@roalcantara
roalcantara / 0_tldr.zsh
Last active December 9, 2023 00:30
Glob (globbing)
## TL;DR
setopt extendedglob
ls *(<tab> # to get help regarding globbing
rm ../debianpackage(.) # remove files only
ls -d *(/) # list directories only
ls /etc/*(@) # list symlinks only
ls -l *.(png|jpg|gif) # list pictures only
ls *(*) # list executables only
ls /etc/**/zsh # which directories contain 'zsh'?
@roalcantara
roalcantara / forked_repo_rebase.sh
Last active November 9, 2023 20:41
Git: Rebasing a Forked Repository Branch
# Disclosure:
# Forked Repo: the original repository
# Fork Repo: your repository
# -- clone your fork
$ git clone https://github.com/roalcantara/equalize.git
# -- enters some branch
$ cd equalize
$ git checkout master
@roalcantara
roalcantara / xcode-uninstall.sh
Created October 24, 2020 11:41
xcode-uninstall
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf /Applications/Xcode.app
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Developer
rm -rf ~/Library/MobileDevice
rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist
@roalcantara
roalcantara / gist:2342555
Created April 9, 2012 09:42
JAVA > Hibernate > Custom Validator Simple Sample
package com.xpto.domain.model.validator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = PhotoExtensionValidator.class)
@Documented
{
"meta": {
"theme": "papirus"
},
"basics": {
"name": "Rogério R. Alcântara",
"label": "Full Stack Developer",
"image": "https://1.gravatar.com/avatar/e4ecb3055d75d5124e52f1a7599fda3a",
"email": "rogerio.alcantara@gmail.com",
"phone": "+55 (11) 996873252",