Skip to content

Instantly share code, notes, and snippets.

@qoomon
qoomon / conventional_commit_messages.md
Last active May 2, 2024 09:52
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@mmozeiko
mmozeiko / !README.md
Last active May 2, 2024 09:51
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone 64-bit MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for 64-bit native desktop app development.

Run python.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.32.17.2 and v10.0.22621.0.

You can list available versions with python.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.

To use cl.exe/link.exe from output folder, first run setup.bat - after that PATH/INCLUDE/LIB env variables will be setup to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.

To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).

@nickelpro
nickelpro / mcvarint.py
Created November 5, 2013 02:20
Two python functions that implement the new Minecraft varint type (32-bit signed integers packed into Google protobuf varints). Packs varints into a byte string, unpacks varints from a buffer that has a read(bytes) method. Supports negative numbers even though they aren't used in the current protocol.
import struct
def pack_varint(val):
total = b''
if val < 0:
val = (1<<32)+val
while val>=0x80:
bits = val&0x7F
val >>= 7
total += struct.pack('B', (0x80|bits))
@jsdario
jsdario / el_quijote.txt
Last active May 2, 2024 09:48
El Quijote en texto plano
This file has been truncated, but you can view the full file.
DON QUIJOTE DE LA MANCHA
Miguel de Cervantes Saavedra
PRIMERA PARTE
CAPÍTULO 1: Que trata de la condición y ejercicio del famoso hidalgo D. Quijote de la Mancha
@thegreatestminer
thegreatestminer / encoded-20201212150102.txt
Created December 12, 2020 15:01
MobaXTerm Professional x64 License Key [READ COMMENTS]
UEsDBBQAAAAIABNQjFGCf/GfLgAAACwAAAAHAAAAUHJvLmtleTMqdncpCXQOKDAp9woMzEo1MTVOrHAzTjTLME7VNs1LK8owTjQpcU8tcuLlAgBQSwECFAAUAAAACAATUIxRgn/xny4AAAAsAAAABwAAAAAAAAAAAAAAAAAAAAAAUHJvLmtleVBLBQYAAAAAAQABADUAAABTAAAAAAA=
@jboner
jboner / latency.txt
Last active May 2, 2024 09:45
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@levi-nz
levi-nz / encrypt.js
Created July 17, 2023 08:22
Adyen 4.5.0 encryption
/*
* Adyen 4.5.0 encryption by github.com/levi-nz
*
* This code is a rough implementation and can be improved in some places.
* Read comments throughout the code for more information.
*/
const jose = require('node-jose');
// Parse the key from the string found in securedFields.html ("10001|...")
@ctrl-freak
ctrl-freak / html-purifier-config.php
Created September 2, 2011 08:02
HTML Purifier Configuration
<?
$purifier_config = HTMLPurifier_Config::createDefault();
$purifier_config->set('HTML.AllowedElements', 'p, a, ul, ol, li, h1, h2, h3, h4, h5, h6, br, strong, em, b, i');
$purifier_config->set('HTML.AllowedAttributes', '');
$purifier_config->set('CSS.AllowedProperties', '');
$purifier_config->set('AutoFormat.RemoveEmpty', true);
$purifier_config->set('AutoFormat.AutoParagraph', true);
// May cause problems with empty table cells and headers
@Gomah
Gomah / 1. useResponsiveVariant.ts
Last active May 2, 2024 09:40
Responsive Variants with CVA, class-variance-authority
import { useMediaQuery } from 'usehooks-ts'
import { useMemo } from 'react';
import resolveConfig from 'tailwindcss/resolveConfig';
import tailwindConfig from '../../tailwind.config';
const fullConfig = resolveConfig(tailwindConfig);
const { screens } = fullConfig.theme;
type Breakpoints = keyof typeof screens;
type ResponsiveValue<T> = T extends boolean ? boolean : T extends string ? T : keyof T;