Skip to content

Instantly share code, notes, and snippets.

View rogeriochaves's full-sized avatar

Rogério Chaves rogeriochaves

View GitHub Profile
@rogeriochaves
rogeriochaves / count_absolutely_right.py
Created July 15, 2025 11:56
Count how many times has cursor said "you're absolutely right" to you
#!/usr/bin/env python3
"""
Script to count messages containing specific terms in Cursor chat history.
Currently searches for "absolutely right" and "great question".
Searches through the SQLite database where Cursor stores chat data.
"""
import sqlite3
import json
import sys
@rogeriochaves
rogeriochaves / main.py
Created July 10, 2023 05:34
MULTI_PROMPT_ROUTER_TEMPLATE improved
"""You help triaging user requests. Given a raw text input, output either DOCS or DEFAULT, according to those definitions:
DOCS: if user is asking a seemingly technical question, programming questions or company-specific questions
DEFAULT: if user is just chit-chatting or basic knowledge questions
====================
Input: hello there
Output: DEFAULT
@rogeriochaves
rogeriochaves / main_fp.py
Last active May 17, 2024 08:32
monadic langchain, a more FP interface to langchain
# This is how langchain chain composition looks with a more FP approach
import re
from typing import (
Literal,
TypedDict,
cast,
)
from dotenv import load_dotenv
@rogeriochaves
rogeriochaves / goodbye_postman.sh
Last active June 29, 2022 12:42
Shortcut to post json with curl from terminal
# Usage:
# post '{"name": "Mr Foo"}' https://myapi/register
#
post () {
local json="$1";
local url="$2";
shift 2;
curl -X POST -H "Content-Type: application/json" --data "$json" "$url" $@
}
const { merge, interval, from, Observable, Subject, zip } = Rx;
const { delay, partition, tap, take, bufferTime, bufferWhen, map, bufferCount, mergeMap, concatAll, windowCount, buffer, mergeAll, filter } = RxOperators;
const topic$ = new Subject();
const retryTopics = [1,2,3,4,5,6,7,8,9,10].map(i =>
delay(1000 * 2 ** i)(new Subject())
);
let i = 0;
setInterval(() => {
@rogeriochaves
rogeriochaves / parser.rb
Created April 13, 2021 21:11
Parse ruby .inspect string to be eval'd
def deinspect(str, level=0)
str.gsub!(/:0x0[^ ]+/, '')
matches = str.match(/<([\w:]+) (.*)>/)
return str unless matches
head = matches[1]
body = matches[2]
hash_content = nil
const thiagoWay = (lista) => {
let ar = lista.map((el) => el.name);
let array_elements = ar.sort();
let current = null;
let cnt = 0;
for (var i = 0; i < array_elements.length; i++) {
delete lista[i].id;
if (array_elements[i] != current) {
@rogeriochaves
rogeriochaves / fetchingState.js
Last active December 15, 2020 18:14
Javascript Fetching State without Booleans
const NOT_ASKED = 'NOT_ASKED';
const LOADING = 'LOADING';
const SUCCESS = 'SUCCESS';
const ERROR = 'ERROR';
export const notAsked = () => ({ state: NOT_ASKED });
export const loading = () => ({ state: LOADING });
export const success = result => ({ state: SUCCESS, result });
export const error = message => ({ state: ERROR, message });
.ghx-controls-filters, .ghx-qty, .ghx-issue-fields .ghx-key, .ghx-card-footer .ghx-type, .ghx-card-footer .ghx-flags, .ghx-card-footer .ghx-end, .ghx-card-footer .ghx-days, #announcement-banner {
display: none!important;
}
#ghx-pool-column {
padding: 0 20px;
}
.ghx-issue .ghx-highlighted-fields .ghx-highlighted-field {
max-width: none;
function trackClick(name) {
if (!name) throw "track needs a name";
ga.track(name);
}