Skip to content

Instantly share code, notes, and snippets.

View sdepablos's full-sized avatar

Sergi de Pablos sdepablos

View GitHub Profile
@sdepablos
sdepablos / cursorrules.md
Last active February 15, 2025 15:17
.cursorrules Claude Typescript/Netx.js with thinking

You are an expert TypeScript/Next.js developer focused on writing clean, maintainable code. Prioritize these qualities:

  1. Minimal: Absolute minimum code needed

  2. Self-documenting: Code explains itself through:

    • Precise naming (verbs for functions, nouns for variables)
    • Single-responsibility components
    • Obvious data flow
@sdepablos
sdepablos / install.ps1
Last active February 3, 2021 18:51
chocolatey + basic apps
# Requires -RunAsAdministrator
# To download and execute
# iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/sdepablos/b856fbf97f79ab5f19e9d23fcc65c709/raw/80201c97b69b85ba36068a8a1f726210a7bfadd2/install.ps1'))
if (!(Get-Package -Name *choco*))
{
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
# Install Scoop
<HTML><HEAD><TITLE>Email Signature</TITLE><META content="text/html; charset=unicode" http-equiv=Content-Type><BODY><P style="FONT-SIZE: 10pt; FONT-FAMILY: 'Helvetica', 'Arial', sans-serif;"><TABLE style="background-color: #FFF; WIDTH: 500px" cellSpacing=0 cellPadding=10 border=0><TBODY><TR><TD width="120" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Helvetica', 'Arial', sans-serif;" vAlign=top ><IMG border=0 src="https://cdn.shopify.com/s/files/1/0243/9705/files/Corina_signature_120x.jpg?v=1598371907" alt="profile" ></TD><TD style="FONT-SIZE: 8pt; FONT-FAMILY: 'Helvetica', 'Arial', sans-serif; WIDTH: 330px;" vAlign=top><SPAN><img src="https://cdn.shopify.com/s/files/1/0243/9705/files/LOGO_02_110x.png?v=1566836148" width="55" align="RIGHT"></SPAN><STRONG><SPAN style="FONT-SIZE: 16pt; COLOR: #FFB71B">CORINA NICULAE</SPAN></STRONG><BR><BR><SPAN style="COLOR: #091C42"><SPAN style="FONT-SIZE: 9pt; COLOR: #091C42"><STRONG>FINANCIAL CONTROLLER</STRONG></SPAN><BR><BR><SPAN style="COLOR: #091C42"></SPAN> <SPAN style="COLOR:
@sdepablos
sdepablos / explicacion.md
Last active May 27, 2020 18:43
Explicación ejercicio

Ejercicio 1

Lo que le faltaba al script eran pedir el elemento HTML con el document.getElementById que obtiene un elemento del HTML (explicación), y luego asignarle a la propiedad backgroundColor del estilo de ese elemento el color calculado. (el identificador el elemento es la propiedad id, en este caso cuadrado)

<script>
	function cambiaColor() { //Esta funcion calcula un color al azar y se lo asigna al elemento
		var opciones = '0123456789ABCDEF';
 var color = '#';
[Desktop Entry]
X-SnapInstanceName=code
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/code_code.desktop /snap/bin/code %U
Icon=/snap/code/11/usr/share/pixmaps/com.visualstudio.code.png
Type=Application
StartupNotify=false
StartupWMClass=Code
curl -s "https://slack.com/api/files.list?token=<your_token>&count=1000&page=1&pretty=1" | grep '"id":' | awk -F'"' '{print $4}' | xargs printf "curl -s 'https://slack.com/api/files.delete?token=<your_token>&file=%s&pretty=1'" | bash
imports:
- { resource: dev.yml }
parameters:
api_key: 1ph0n3Ulab0x!+
api_url: https://api.ulabox.com
api_verify: true
@sdepablos
sdepablos / gist:f2704672eb8feef7f339
Created December 23, 2014 08:01
Testing has table collision keys
<?php
# More info at http://lukasmartinelli.ch/web/2014/11/17/php-dos-attack-revisited.html
$file = 'https://github.com/lukasmartinelli/php-dos-attack/blob/master/collision_keys.txt';
$handle = fopen($file, 'r');
$a = [];
while (($buffer = fgets($handle)) !== false) {
$a[$buffer] = $buffer;
}
fclose($handle);
$intersections = false;
$filters = false;
// If any follows, followed_by, or tags are specified, attempt to narrow the search.
foreach ($this->follows as $cond)
{
$filters = true;
$keys = $this->database->set_members(Stalkr::get_type_table($this->type) . ':fing:' . $cond);
if (!$keys) continue;