Skip to content

Instantly share code, notes, and snippets.

@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active September 26, 2025 20:31
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
#!/bin/bash
clear
while true; do
read -p 'C:\>' cmd
case $cmd in
ver)
echo -e "\nMS-DOS Version 6.22\n\n" ;;
@juanpabloaj
juanpabloaj / func_pointers.c
Last active April 15, 2018 20:13
C: return function pointer
#include <assert.h>
int sum(int a, int b)
{
return a + b;
}
int multi(int a, int b)
{
return a * b;
@dsernst
dsernst / comparing-git-add-all.md
Last active January 29, 2025 15:16
Compare `git add .` vs `git add -A`

git add . vs git add -A

Both of these will stage all files, including new files (which git commit -a misses) and deleted files.

The difference is that git add -A also stages files in higher directories that still belong to the same git repository. Here's an example:

/my-repo
  .git/
 subfolder/
@moo3
moo3 / cors_server.py
Last active May 20, 2018 05:25 — forked from enjalot/cors_server.py
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
@mstijak
mstijak / zip.bat
Last active January 12, 2020 20:02
7z update archive + remove deleted files
7z u Scripts.zip Scripts\*.sql -uq0
@cgcardona
cgcardona / gist:772b5e040e26cb71a8d5
Last active April 3, 2024 20:51
Get the RGBa value for each pixel in an image via <canvas>
$(document).ready(function (){
// Get the image and canvas nodes
var img = $('#original_image')[0];
var canvas = $('#original_canvas')[0];
// confirm that the image has loaded
img.addEventListener("load", function() {
// set the canvas dimensions
canvas.width = img.width;
canvas.height = img.height;
@hofmannsven
hofmannsven / README.md
Last active October 2, 2025 20:17
Git CLI Cheatsheet
@ramalho
ramalho / relogio.py
Last active April 17, 2022 22:21
Um relógio bem simples feito em Python com Tkinter. Vídeo de demonstração: http://www.youtube.com/watch?v=xCiPshN9nOs
#!/usr/bin/env python3
import tkinter
from time import strftime
def tic():
rel['text'] = strftime('%H:%M:%S')
def tac():
tic()
rel.after(1000, tac)
@jboner
jboner / latency.txt
Last active October 16, 2025 23:33
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