Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active May 4, 2024 18:45
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
@UbuntuEvangelist
UbuntuEvangelist / How to Install Doxygen on Ubuntu
Created September 5, 2023 21:40
How to Install Doxygen on Ubuntu 22.04.3 LTS (jammy)
Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, and to some extent D. Doxygen also supports the hardware description language VHDL.
sudo apt-get install flex
sudo apt-get install bison
git clone https://github.com/doxygen/doxygen.git
cd doxygen
@superkojiman
superkojiman / namemash.py
Last active May 4, 2024 18:42
Creating a user name list for brute force attacks.
#!/usr/bin/env python3
'''
NameMash by superkojiman
Generate a list of possible usernames from a person's first and last name.
https://blog.techorganic.com/2011/07/17/creating-a-user-name-list-for-brute-force-attacks/
'''
@wojteklu
wojteklu / clean_code.md
Last active May 4, 2024 18:40
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0)
rajdsouza:web rajdsouza$ brew install homebrew/php/php55 --with-fpm --without-apache --with-gmp --with-mssql --with-tidy --without-snmp
==> Installing php55 from homebrew/homebrew-php
==> Installing dependencies for homebrew/php/php55: openssl, readline
==> Installing homebrew/php/php55 dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
@Vivek-abstract
Vivek-abstract / queen_hill_climbing.py
Created December 1, 2018 12:08
Solving the 8-Queen Problem using Hill Climbing Search
import copy
import numpy as np
import chess
import sys
from chess import svg
def exists(i, j):
# Checks if square exists within boundary
@ThisIsRigged
ThisIsRigged / paymenter_uninstall
Last active May 4, 2024 18:31
Paymenter Remove Script
#!/bin/bash
# Function to uninstall Paymenter
uninstall_paymenter() {
# Stop Nginx
sudo systemctl stop nginx
# Stop Queue Worker
sudo systemctl stop paymenter.service
#!/bin/bash
# Function to install SSL using Certbot
install_ssl() {
echo "Installing Certbot and configuring SSL for $1..."
apt -y install certbot python3-certbot-nginx
certbot --nginx -d $1
echo "SSL configured successfully."
}
@kolayne
kolayne / hackerize_xs_decryptor.py
Last active May 4, 2024 18:31
Hackerize XS decoder
#!/usr/bin/python3
def decode(s):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
hackerized = 'Λß↻Ð☰∲ç╫¡¿├↑ღ∏☐þ¶┏§⊥üƴ₪✕¥ᶾ'
ans = ''
for c in s:
try:
ans += alphabet[hackerized.index(c)]
except ValueError: