Skip to content

Instantly share code, notes, and snippets.

View Jacajack's full-sized avatar
🦄

Jacek Wieczorek Jacajack

🦄
View GitHub Profile
@jeffamstutz
jeffamstutz / get_imgui.cmake
Created February 8, 2021 14:35
CMake FetchContent to get ImGui
FetchContent_Populate(imgui
URL https://github.com/ocornut/imgui/archive/docking.zip
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/imgui
)
set(OpenGL_GL_PREFERENCE "LEGACY")
find_package(OpenGL 2 REQUIRED)
find_package(glfw3 REQUIRED)
add_library(imgui_glfw STATIC
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
@da-n
da-n / usb-unlock-luks.md
Created August 24, 2019 13:11
Unlock LUKS full disk with USB stick

Configuration for passwordless root filesystem

Source: https://www.howtoforge.com/tutorial/passwordless-encryption-of-linux-root-partition/

The process of entering the passphrase at boot time will now be automated using an USB memory stick. Instead of using a passphrase , the secret key on the USB will decrypt the encrypted volumes. Connect an USB stick to the VM and locate it using the dmesg command. It is detected as /dev/sdb in my VM.

The secret key of 8192 random byte is extracted from the usb stick using the dd command.

dd if=/dev/sdb of=/root/secret.key bs=512 skip=4 count=16
@bloc97
bloc97 / TwoMethods.md
Last active February 20, 2024 12:19
Two Fast Methods of Generating True Random Numbers on the Arduino

Two Fast Methods of Generating True Random Numbers on the Arduino

Arduino true random number generator

B. Peng

December 2017

Abstract

The AVR series microcontrollers are a collection of cheap and versatile chips that are used in many applications ranging from hobbist projects to commercial infrastructure. One major problem for some hobbists is the lack of secure random number generation on the Arduino platform. The included pseudo-random number generator (PRNG) is very easy to defeat and is useless for any crypto-related uses. One recommendation from the Arduino Reference Manual is to use atmospheric noise from the chip's analog sensor pins as seed data[6].
Unfortunately this method is extremely weak and should not be used to emulate a true random number generator (TRNG). Existing methods such as using the internal timer drift or using a dedicated generator are either too slow, requires extensive external hardware or modifications to the microcontroller's internal mech

@leoloobeek
leoloobeek / get_gists.py
Created April 26, 2017 21:34
Download all gists for a specific user
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
@metacollin
metacollin / ltspice.md
Last active April 30, 2022 10:28
LTSpice color scheme - Twilight After Dawn

screenshot

LTSpice color scheme - Twilight After Dawn

                |  R    |  G    |  B    |
Wires           |  138  |  154  |  149  |
Junctions       |  152  |  205  |  255  |
Component body  |  207  |  106  |  76   |
Graphic Flag | 218 | 239 | 163 |
@thinkl33t
thinkl33t / gist:73e90fd5463622be1ca3f8abd6940659
Last active March 7, 2024 14:17
RGBW Bluetooth LED controller protocol

Controller for an RGBW LED strip purchased from AliExpress

It only appears to fire up the RGB strip or the white strip, never both at once.

Endpoint = 0xb = 0000ffe9-0000-1000-8000-00805f9b34fb

cc2333 - fade on, to whichever output / colour was used last.  Will re-fade if reissued.
cc2433 - fade off

56xxxxxxyyf0aa - change to RGB output - xxxxxx = colour code in hex. yy = anything hexy

@MightyPork
MightyPork / usb_hid_keys.h
Last active April 17, 2024 19:25
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@kriswebdev
kriswebdev / novpn.sh
Last active April 9, 2024 06:24
novpn: Bypass VPN for specific apps [Linux / OpenVPN]
#!/bin/bash
# === INFO ===
# NoVPN
# Description: Bypass VPN tunnel for applications run through this tool.
VERSION="3.0.0"
# Author: KrisWebDev
# Requirements: Linux with kernel > 2.6.4 (released in 2008).
# This version is tested on Ubuntu 14.04 and 19.10 with bash.
# Main dependencies are automatically installed.
@oleksiiBobko
oleksiiBobko / tcp_server.c
Last active November 10, 2023 08:48
Simple socket server in C using threads (pthread library) Compiles on linux
/*
C socket server example, handles multiple clients using threads
Compile
gcc server.c -lpthread -o server
*/
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>