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 / elastic-pokemon.rest
Created January 29, 2021 13:16
Elasticsearch CRUD Quickstart
@roalcantara
roalcantara / elasticsearch.sh
Last active January 19, 2021 17:44
Elasticsearch bootstrap
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
brew services start elastic/tap/elasticsearch-full
brew install elastic/tap/kibana-full
brew services start elastic/tap/kibana-full
@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 / keyboard.md
Created December 13, 2020 05:02
Apple Mac OSX Keyboard Symbols
Icon Name Unicode Font
Power 3 U+233D
Apple symbol 1 U+F8FF Lucida Grande
Command (Open Apple) 2 U+2318
Control U+2303
Option (Alt) U+2325
Shift U+21E7 Apple Symbols
Capslock U+21EA
Escape U+238B
@roalcantara
roalcantara / for_each.sh
Created October 26, 2020 14:50
Run a command for each line
ls -1 | while read line ; do echo $line ; done
# https://stackoverflow.com/a/2711008/1603694
@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 / 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 / rename.sh
Created October 17, 2020 22:33
[Bash] Rename all files
brew install rename
rename -n -cs icon_ folder_ *
# -n (dry-run)
# -c (lower-case)
# -s (subst [from to])
# http://plasmasturm.org/code/rename/
// When creating factories in TypeScript using generics, it is necessary to refer to class types by their constructor functions.
// For example:
function create<T>(c: { new (): T }): T {
return new c();
}
// A more advanced example uses the prototype property to infer and constrain relationships between the constructor
// function and the instance side of class types.