Skip to content

Instantly share code, notes, and snippets.

View steffensbola's full-sized avatar
🇧🇷

Cristiano Steffens steffensbola

🇧🇷
View GitHub Profile

Setting Up Automatic Power On

Open Terminal on your Mac

Set up the schedule using this command:

sudo pmset repeat wakeorpoweron MTWRF 08:00:00

This command means:
pmset repeat - sets a repeating schedule.
wakeorpoweron - wakes or powers on the Mac.

@steffensbola
steffensbola / TechLead Agent Prompt - Refinement.md
Created July 16, 2025 13:45
Instructs LLMs to help refine work items

TechLead Agent Prompt

You are a TechLead Agent assigned to participate in a refinement meeting. Your primary goal is to provide meaningful contributions that will help the Product Manager and Engineering Manager create a clear and actionable description and acceptance criteria for Product Backlog Items (PBIs) before they are assigned to the development team. Use azuredevops MCP to get PBI information.

Your Tasks:

  1. Review the PBI Description: Read the provided PBI description thoroughly. Identify any ambiguities or unclear terms that may hinder understanding.

  2. Examine the Parent Feature Description: Understand the broader context by reviewing the parent feature description. Ensure that the PBI aligns with the overall goals and objectives of the feature.

@steffensbola
steffensbola / mcp.json
Last active June 18, 2025 20:36
Must have MCPs config for vscode
{
"servers": {
"sequential-thinking": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
},
"fetch": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/fetch"]
},
@steffensbola
steffensbola / get_local_storage_size.js
Created May 28, 2025 13:42
Get the size of each entry in the Browser Local Storage
/* Gets the size of each entry in the Browser Local Storage. Original: https://stackoverflow.com/questions/4391575/how-to-find-the-size-of-localstorage*/
var _lsTotal=0,_xLen,_x;for(_x in localStorage){ if(!localStorage.hasOwnProperty(_x)){continue;} _xLen= ((localStorage[_x].length + _x.length)* 2);_lsTotal+=_xLen; console.log(_x.substr(0,50)+" = "+ (_xLen/1024).toFixed(2)+" KB")};console.log("Total = " + (_lsTotal / 1024).toFixed(2) + " KB");
@steffensbola
steffensbola / stripStyleFromHTML.ts
Last active May 6, 2025 20:57
Regex based function to strip style from HTML/ including malformatted html
/**
* Strips all style attributes and style tags from HTML using regex
* (Note: This is a simplified approach - regex may have edge cases with complex HTML)
* @param html Partial HTML string to process (can be invalid)
* @returns HTML string with style attributes and tags removed
*/
function stripStylesWithRegex(html: string): string {
// Remove style attributes (handles single and double quotes)
let cleaned = html.replace(/style\s*=\s*(["']).*?\1/gi, '');
// This is a hard coded implementation of a text classifier
export class InstructionClassifier {
private static questionWords = [
'how', 'what', 'when', 'where', 'why', 'who',
'is', 'are', 'was', 'were', 'do', 'does', 'did',
'can', 'could', 'will', 'would', 'should', 'may', 'might'
];
private static instructionalVerbs = [
@steffensbola
steffensbola / domain_indexed_by_search_engine.ts
Created October 1, 2024 20:26
Checks if domain is reachable, if it has a robots file or tags that tell the search enginenot to index them.
import axios from 'axios';
interface Subdomain {
url: string;
shouldIndex?: boolean;
shouldIndexRobots?: boolean;
shouldIndexMeta?: boolean;
isAccessible: boolean
}
@steffensbola
steffensbola / extractLaunchDarklyPayloadFromUrl.js
Created September 18, 2024 18:44
Extracts the Launch Darkly context from GET URL
function extractLDPayload(url) {
// Extract the Base64-encoded payload from the URL
const encodedPayload = url.split('/').pop();
// Decode the Base64-encoded payload
const decodedPayload = atob(encodedPayload);
// Parse the decoded payload as JSON
const payload = JSON.parse(decodedPayload);
@steffensbola
steffensbola / launchdarkly_turn_rule_values_str.js
Created August 21, 2024 13:18
Converts LaunchDarkly values in rules to str
/*
When you paste numeric values to https://app.launchdarkly.com/ `Rules` it will automatically parse them to numbers, even if the field type is string.
This clicks every chip in the flag configuration page to switch from int to str.
Must be run from browser console.
Credits: B Roldao
*/
function triggerReactEventOnSpansWithNum() {
const spans = document.querySelectorAll('span.Chip.Chip--default.Chip--subtle.SelectAttributeValue-type.SelectAttributeValue-type--number');
spans.forEach(span => {
@steffensbola
steffensbola / salesforce_client.js
Last active June 27, 2024 20:54
Simple JS client to connect to the Salesforce API
import axios from 'axios';
import dotenv from 'dotenv';
import assert from 'assert';
dotenv.config();
assert(process.env.SF_CONSUMER_KEY, 'SF_CONSUMER_KEY not set');
assert(process.env.SF_CONNECTED_APP_API_NAME, 'SF_CONNECTED_APP_API_NAME not set');
assert(process.env.SF_CONSUMER_SECRET, 'SF_CONSUMER_SECRET not set');
assert(process.env.SF_USERNAME, 'SF_USERNAME not set');