Skip to content

Instantly share code, notes, and snippets.

View gabriel-rcpereira's full-sized avatar
🤘

Gabriel Pereira gabriel-rcpereira

🤘
  • Porto Alegre-RS, Brazil
View GitHub Profile
@gabriel-rcpereira
gabriel-rcpereira / txt
Created July 23, 2025 13:50
List all gradle dependencies
./gradlew dependencies $(./gradlew -q projects \
| grep -Fe ---\ Project \
| sed -Ee "s/^.+--- Project '([^']+)'/\1:dependencies/") > all-dependencies.txt
@gabriel-rcpereira
gabriel-rcpereira / useful-commands.md
Last active February 3, 2025 22:55
Useful commands

Gradle

Kill process that locks Gradle file:

PID=`fuser -c [path]/journal-1.lock`
kill -9 $PID

Stop Gradle processes

@gabriel-rcpereira
gabriel-rcpereira / curl.md
Created June 22, 2023 20:22 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@gabriel-rcpereira
gabriel-rcpereira / gist:5799b06dc7167138e7d8403e8574e3f9
Last active November 1, 2022 13:03 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(n) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@gabriel-rcpereira
gabriel-rcpereira / useful-bash-commands.md
Last active January 24, 2022 13:45
Useful bash commands

Update all folders that have .git

find . -maxdepth 1 -type d -print -execdir git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;
  • find . searches the current directory
  • maxdepth 1 for a maximum depth of one sub-directory
  • type d to find directories, not files
  • execdir {} ; runs a custom command for every find
@gabriel-rcpereira
gabriel-rcpereira / serving-pdf-files-express-api.md
Last active January 24, 2022 13:47
Serving a PDF file in memory - NodeJS + Express

How to serving PDF file in memory - NodeJS + Express

To be honest, I googled a lot to learn something to fit in my context and after to consume, to read, and let some hairs on the way(Lol) I found a solution! (Inspired by Al Scoot)

What's the problem?

There are some approaches to serve a PDF file through a Rest Express API, for example download method: send.download(filePath). But when you need to serve a file in memory the problem becomes hard to solve and there aren't many developers talking about it.

The probably(and obvious) solution