Skip to content

Instantly share code, notes, and snippets.

View Shide's full-sized avatar

Eduardo de Miguel Shide

View GitHub Profile
@jboner
jboner / latency.txt
Last active November 15, 2024 14:00
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
@binaryphile
binaryphile / one-handed.ahk
Created August 31, 2012 17:38
Simple One-handed Keyboard Autohotkey script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Toggle := False
$Space::
KeyWait, Space, T0.15 ; Adjust this value to control the delay before switching modes
If ErrorLevel
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 14, 2024 09:13
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@alvarouribe
alvarouribe / gist:4627820
Last active November 26, 2020 13:53
Accesos Directos Sublime Text 2 - Espanol

Sublime Text 2 – Accesos Directos (PC y Linux)

“Toda la documentacion aca” :http://www.sublimetext.com/docs/2/.

Edicion

Ctrl+C (si no hay seleccion) Copia toda la linea
Ctrl+X (si no hay seleccion) Corta toda la linea
Ctrl+⇧+K Elimina la linea
Ctrl+↩ Inserta salto de linea en linea anterior
@greinacker
greinacker / master_pg_hba.conf
Last active September 11, 2023 01:10
PostgreSQL 9.2.x replication
hostssl replication replicator 5.6.7.8 md5
@dutc
dutc / generators-free-your-mind.ipynb
Last active November 5, 2024 08:30
IPython Notebook for "Generators Will Free Your Mind"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yelizariev
yelizariev / 1-Constitution.md
Last active February 20, 2021 00:05
IT-Projects LLC rules. The document is moved to https://gitlab.com/itpp/handbook/

Constitution explains how and in what direction is the company growing

I. Just work well

  • The only way to compensate poorly made work is to improve yourself and do it well

I.1. No penalties

  • There are no any financial, moral, administrative penalties

I.2. No excuses

  • Inside the company, excuses have no sense
@erikbern
erikbern / use_pfx_with_requests.py
Last active October 24, 2024 12:26
How to use a .pfx file with Python requests – also works with .p12 files
import contextlib
import OpenSSL.crypto
import os
import requests
import ssl
import tempfile
@contextlib.contextmanager
def pfx_to_pem(pfx_path, pfx_password):
''' Decrypts the .pfx file to be used with requests. '''
@andrebrait
andrebrait / keychron_linux.md
Last active November 7, 2024 08:48
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.