Skip to content

Instantly share code, notes, and snippets.

View bitcodr's full-sized avatar
👨‍💻
Focusing...

Amir Roshanaei bitcodr

👨‍💻
Focusing...
View GitHub Profile
@bitcodr
bitcodr / latency.md
Last active October 1, 2025 11:38
Latency Numbers For Software Engineers (2024-2025 Edition)

Core System Latencies

Operation                                    Latency        Human Scale*
═══════════════════════════════════════════════════════════════════════
L1 cache reference                           0.5 ns        1 second
Branch mispredict                            5   ns        10 seconds
L2 cache reference                           7   ns        14 seconds
Mutex lock/unlock                           25   ns        50 seconds
Main memory reference                      100   ns        3.3 minutes
@machuu
machuu / WSL2_VPN_Workaround_Instructions.md
Last active July 19, 2025 14:04
Workaround for WSL2 network broken on VPN

Overview

Internet connection and DNS routing are broken from WSL2 instances, when some VPNs are active.

The root cause seems to be that WSL2 and the VPN use the same IP address block, and the VPN routing clobbers WSL2's network routing.

This problem is tracked in multiple microsoft/WSL issues including, but not limited to:

@petrstepanov
petrstepanov / install-facetime-hd-webcam.sh
Created September 28, 2020 04:22
Linux Install FaceTimeHD Camera
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
@bitcodr
bitcodr / unfollow.js
Last active August 26, 2020 15:38
Bulk unfollow specific users according to thier jobs in Linkedin
// 1 - go to this page https://www.linkedin.com/feed/following/
// 2 - open browser console past the code as below and click Run
var buttons = $("button"),
interval = setInterval(function(){
var btn = $('.is-following');
var v = document.querySelectorAll("p.follows-recommendation-card__headline");
for(y in v)
{
@ukn
ukn / 99-install-facetime-camera.sh
Last active April 12, 2025 09:13 — forked from Stono/99-install-facetime-camera.sh
Install the kernal module required for the facetimehd camera to work on Linux
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
@bitcodr
bitcodr / init.vim
Last active April 30, 2020 14:19
My NeoVim config
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd!
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.config/nvim/plugged')
"File Search:
Plug 'ctrlpvim/ctrlp.vim' " fuzzy find files
@bitcodr
bitcodr / latency.txt
Last active April 2, 2023 07:18 — forked from jboner/latency.txt
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
@udomsak
udomsak / postman_fc29_install.sh
Created December 24, 2018 17:00
Install postman on Fedora core 29 - Dec 2018
#!/bin/bash
wget https://dl.pstmn.io/download/latest/linux64 -O postman-linux-x64.tar.gz
sudo tar xvzf postman-linux-x64.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
cat << EOF > ~/.local/share/applications/postman2.desktop
[Desktop Entry]
Name=Postman
GenericName=API Client
@lucasbrynte
lucasbrynte / 20-multi-gpu-setup.conf
Last active January 23, 2022 14:39
Manjaro multi-GPU setup intel integrated GPU + external nVidia GPUs
# /etc/X11/xorg.conf.d/20-multi-gpu-setup.conf
# Inspired by: https://gist.github.com/alexlee-gk/76a409f62a53883971a18a11af93241b
Section "ServerLayout"
Identifier "layout"
Screen 0 "intel"
Screen 1 "nvidia1"
Screen 2 "nvidia2"
EndSection
@rodrigopedra
rodrigopedra / BelongsToManyInDifferentConnections.php
Created June 22, 2018 17:29
Laravel BelongsToMany in different connections
<?php
namespace App\Models;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class BelongsToManyInDifferentConnections extends BelongsToMany