Skip to content

Instantly share code, notes, and snippets.

View guilsa's full-sized avatar
👋
@ Looking for projects

Guilherme Sa guilsa

👋
@ Looking for projects
View GitHub Profile
@guilsa
guilsa / fetch-html.sh
Created September 19, 2025 16:49
HTML downloader script
#!/bin/bash
# A script to download the HTML content from a list of URLs.
# How to use: `chmod +x fetch-html.sh`
# ./fetch-html.sh urls.txt ./downloaded_pages
# This will read the links from `urls.txt` and save the corresponding HTML files into the `downloaded_pages` directory. Let me know if you'd like any tweaks.
# I use Link Gopher on Firefox to manually create my links.
set -euo pipefail # Fail fast on errors
@guilsa
guilsa / llm_use_cases.md
Last active September 3, 2025 17:56
Open-weight LLM models skills-set

Qwen3

  • math, coding, and reasoning (in mid-range hardware like Macbook Air M4)
  • Specific model:
    • Qwen2.5-7B-Instruct: cited here by LM Studio team as perform well in a wide variety of tool use cases)

Gemma 3

  • multilingual support
  • factual knowledge
  • vision capabilities
@guilsa
guilsa / prompts.md
Last active August 13, 2025 12:32
LLM Prompts I found around the web

Summarize

Summarize the themes of the opinions expressed here. For each theme, output a markdown header. Include direct "quotations" (with author attribution) where appropriate. You MUST quote directly from users when crediting them, with double quotes. Fix HTML entities. Output markdown. Go long. Include a section of quotes that illustrate opinions uncommon in the rest of the piece.

Async Coding Agent

Jules

AI coding agent by Google Labs:

  • Everyday dev tasks
@guilsa
guilsa / vaiLula.sh
Last active October 3, 2022 00:14
Eleição Brasil - Primeiro Turno 2022
#!/bin/bash
while true
do
lula=$(curl -s https://resultados.tse.jus.br/oficial/ele2022/544/dados-simplificados/br/br-c0001-e000544-r.json | jq '.cand[] | select(.nm == "LULA").vap | tonumber' 2> /dev/null )
bozo=$(curl -s https://resultados.tse.jus.br/oficial/ele2022/544/dados-simplificados/br/br-c0001-e000544-r.json | jq '.cand[] | select(.nm == "JAIR BOLSONARO").vap | tonumber' 2> /dev/null )
echo $(( $lula - $bozo ))
sleep 30
@guilsa
guilsa / leetcode.js
Last active March 11, 2022 18:35
Leetcode Stuff
// Remove Element (3/11)
// https://leetcode.com/problems/remove-element/
// time o(n) | space o(1)
var removeElement = function(nums, val) {
let count = 0;
for (let i = 0; i < nums.length; i++) {
if (nums[i] !== val) {
nums[count] = nums[i];
count++;
@guilsa
guilsa / fbTechnicalScreen.js
Last active March 3, 2022 22:39
Solutions - FB Technical Screen Interview Guide (Algorithms)
// Max Ice Cream (3/3)
var maxIceCream = function(costs, coins) {
costs.sort();
for (let i = 0; i < costs.length; i++) {
if (coins >= costs[i]) {
coins -= costs[i];
} else {
return i
}
}
@guilsa
guilsa / data-structures.js
Last active May 3, 2022 15:01
CS Data Structures
// Min Heap
// since JS does not have a native heap,
// for an interview you can quickly code-up something like this
// letting interviewer know what you are doing
class MinHeap {
constructor(compareFunc) {
this.compareFunc = compareFunc;
this.heap = [];
}
@guilsa
guilsa / node_databases.md
Last active December 22, 2021 17:30
Node.js database tools (notes)

better-sqlite3

  • great for prototyping all kinds of apps (non production usages) or unit testing
  • pretty good experience with raw queries

sequelize

  • it's an orm, so boooo!
  • plug n play
  • creation of models feels mandatory (sequelize-auto can be used to auto-generate your models if there's an existing db)
  • there is no pluck() to flatten queries like select * from table1 (currently resolving this by writing out another variable for every query)
@guilsa
guilsa / createElementScript.js
Created December 8, 2021 21:43
Load JavaScript files dynamically from browser console
// source: https://aaronsmith.online/easily-load-an-external-script-using-javascript/
/**
* Loads a JavaScript file and returns a Promise for when it is loaded
*/
const loadScript = src => {
return new Promise((resolve, reject) => {
const script = document.createElement('script')
script.type = 'text/javascript'
script.onload = resolve
@guilsa
guilsa / CS_algorithms.js
Last active May 31, 2022 00:15
Algorithm Problems
// Climbing Stairs (5/13)
// - can be modeled as a graph problem
// - starting from 0 we can take 1 step and get to 1 or take 2 steps and get to 2
// - then from 1 we can take 1 step and get to 2 or take 2 steps and get to 3, and so on
// - if we get to n from a branch, we've found one way
// - recursion can be used to count number of unique paths that can count to n
// - to avoid repeated work, we can cache
// - if we don't cache, it's 2^n time because we must branch out two ways, n times
// - if we cache, it's linear time/space
// - finally, we can reduce to constant space by computing total distinct ways