Skip to content

Instantly share code, notes, and snippets.

@MiggieNRG
MiggieNRG / settings.json
Created January 5, 2022 00:30
VSCode Settings (Updated)
{
"terminal.integrated.fontSize": 14,
"workbench.iconTheme": "material-icon-theme",
"workbench.startupEditor": "newUntitledFile",
"polacode.backgroundColor": "#6633CC",
"editor.tabSize": 2,
"editor.fontSize": 16,
@MiggieNRG
MiggieNRG / AdbCommands
Created January 4, 2022 19:40
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@MiggieNRG
MiggieNRG / cache.py
Created January 4, 2022 19:30
A Simple Python Memory Cache Library
# -*- coding: utf-8 -*-
#
# A simple memory cache library
# Author: Craig Russell <[email protected]>
#
import time
class Cache(object):
@MiggieNRG
MiggieNRG / decrypt_dbeaver.py
Created January 4, 2022 19:28
DBeaver password decryption script - for newer versions of DBeaver
# https://stackoverflow.com/questions/39928401/recover-db-password-stored-in-my-dbeaver-connection
# requires pycryptodome lib (pip install pycryptodome)
import sys
import base64
import os
import json
from Crypto.Cipher import AES
@MiggieNRG
MiggieNRG / 01-directory-structure.md
Created January 4, 2022 19:25
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories lib/ is intended for code that can run as-is src/ is intended for code that needs to be manipulated before it can be used build/ is for any scripts or tooling needed to build your project dist/ is for compiled modules that can be used with other systems.

@MiggieNRG
MiggieNRG / cheat_sheet.txt
Created January 4, 2022 12:12
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
@MiggieNRG
MiggieNRG / latency.txt
Created January 4, 2022 00:55
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
@MiggieNRG
MiggieNRG / map_clsloc.txt
Created January 4, 2022 00:51
Image net classes + labels
n02119789 1 kit_fox
n02100735 2 English_setter
n02110185 3 Siberian_husky
n02096294 4 Australian_terrier
n02102040 5 English_springer
n02066245 6 grey_whale
n02509815 7 lesser_panda
n02124075 8 Egyptian_cat
n02417914 9 ibex
n02123394 10 Persian_cat
@MiggieNRG
MiggieNRG / clean_code.md
Created January 3, 2022 00:35
Summary of 'Clean code'

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

@MiggieNRG
MiggieNRG / Makefile
Last active January 2, 2022 20:39
Self-documenting makefiles
# Example makefile with some dummy rules
.PHONY: all
## Make ALL the things; this includes: building the target, testing it, and
## deploying to server.
all: test deploy
.PHONY: build
# No documentation; target will be omitted from help display
build: