Skip to content

Instantly share code, notes, and snippets.

View wrandowR's full-sized avatar
:electron:

W'w wrandowR

:electron:
  • Rappi
  • Seoul
View GitHub Profile
@wrandowR
wrandowR / SemanticCommitMessages.md
Last active July 13, 2023 23:54
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): [<task code>] <subject>

<scope> is optional.

[<task code>] for your task or ticket software like Jira.

func Normalize(text string) string {
rgTable := rangetable.Merge(unicode.Mn, unicode.P)
t := transform.Chain(norm.NFD, runes.Remove(runes.In(rgTable)), norm.NFC)
text, _, err := transform.String(t, text)
if err != nil {
log.WithError(err).Error("Error normalizing text")
return internalNormalize(text)
@wrandowR
wrandowR / delete-redis-keys-with-a-pattern.md
Last active May 13, 2022 13:39
Delete Redis keys with a pattern

Delete Redis keys with a pattern

** Avoid having to create a script to delete a set of Redis keys, do it from your terminal **

Since the Redis client does not have a native function to delete keys given a pattern or expression, it is usually customary to use the KEYS function that allows bringing all the keys that match a pattern and later these keys are traversed and the deletion is executed, but Normally you require a script that is the one that does these operations without being able to do it from the native redis client.

In this snippet we take advantage of one of the advantages of Redis as of version 2.6.0, which is the ability to execute Lua scripts Through the EVAL command, allowing us to delete redis keys from our terminal as if we were using the DEL command but for a pattern that we want.

Delete all git branches except "master"

git branch | grep -v "master" | xargs git branch -D