Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 15, 2025 14:30
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

@RedToor
RedToor / btDVR.py
Last active November 8, 2023 19:41
BruteForce IP CAMERA H.264 DVR - Exploit
# Exploit Title: BruteForce IP CAMERA H.264 DVR
# Google Dork: intext:Any time & Any where IP Surveillance for Your Life
# Date: 10/2/15
# Exploit Author: RedToor
# Source: https://gist.github.com/RedToor/71a109a7732884714e8ee07f61cfda59
# Version: ALL
# Tested on: Windows and Linux
# USE:
# python btDVR.py -h 127.0.0.1 -p 3000 -l passwords.txt -u admin
#
@vasanthk
vasanthk / System Design.md
Last active May 16, 2025 07:32
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@bkaradzic
bkaradzic / orthodoxc++.md
Last active May 14, 2025 23:21
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@zabirauf
zabirauf / expng.ex
Created July 23, 2015 08:32
PNG format Parser in Elixir
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
@samrat
samrat / sdl2_stbtt.c
Last active January 2, 2025 12:28
Drawing text into a bitmap w/ stb_truetype
#include "SDL.h"
/*
Compilation:
============
gcc -g --std=c99 -o sdl2_stbtt sdl2_stbtt.c `sdl2-config --cflags --libs` -lm
Usage:
======
./sdl2_stbtt /usr/share/fonts/TTF/LiberationMono-Regular.ttf
@t-mat
t-mat / minimal_vst2x_host.cpp
Last active June 7, 2024 06:22
WIN32 : Minimal VST 2.x host in C++11.
// Win32 : Minimal VST 2.x Synth host in C++11.
//
// This is a simplified version of the following project by hotwatermorning :
// A sample VST Host Application for C++ Advent Calendar 2013 5th day.
// https://github.com/hotwatermorning/VstHostDemo
//
// Usage :
// 1. Compile & Run this program.
// 2. Select your VST Synth DLL.
// 3. Press QWERTY, ZXCV, etc.
@hadess
hadess / 0001-mmc-sdhci-Disable-run-time-PM.patch
Last active January 7, 2023 18:30
Baytrail-T Wi-Fi stability patch
From df5bb0eca11e6ab072908b6e0d2e7d9e01d1eb84 Mon Sep 17 00:00:00 2001
From: Dong Aisheng <[email protected]>
Date: Wed, 24 Jun 2015 21:28:48 +0200
Subject: [PATCH] mmc: sdhci: get runtime pm when sdio irq is enabled
SDIO cards may need clock to send the card interrupt to host.
Thus, we get runtime pm when sdio irq is enabled to prevent the clock
resource is released and put it when sdio irq is disabled.
Signed-off-by: Dong Aisheng <[email protected]>
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 12, 2025 01:59
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@fukuroder
fukuroder / wave_play_wasapi_shared.cpp
Last active July 8, 2021 06:38
wave file player (WASAPI shared mode)
/*
* wave_play_wasapi_shared.cpp
*
* Created by fukuroda (https://github.com/fukuroder)
*/
// windows API
#include <windows.h>
#include <audioclient.h>
#include <mmdeviceapi.h>