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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clean -xfd | |
| git submodule foreach --recursive git clean -xfd | |
| git reset --hard | |
| git submodule foreach --recursive git reset --hard | |
| git submodule update --init --recursive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ============================================================================= | |
| // XNU kperf/kpc demo | |
| // Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges | |
| // | |
| // | |
| // Demo 1 (profile a function in current thread): | |
| // 1. Open directory '/usr/share/kpep/', find your CPU PMC database. | |
| // For M1 (Pro/Max), the database file is '/usr/share/kpep/a14.plist'. | |
| // 2. Select a few events that you are interested in, | |
| // add their names to the `profile_events` array below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Diagnostics; | |
| namespace Interpolation | |
| { | |
| /// <summary> | |
| /// Spline interpolation class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name 微信读书下载 | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description 下载微信读书的书籍资源 | |
| // @author You | |
| // @match https://weread.qq.com/web/reader/* | |
| // @grant unsafeWindow | |
| // @grant GM_setValue | |
| // @grant GM_getValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cStringIO | |
| import sys | |
| class IOCapture(object): | |
| def __init__(self, stdout = True, stderr = True): | |
| self.captured_stdout = None | |
| self.captured_stderr = None | |
| if stdout: | |
| self.captured_stdout = cStringIO.StringIO() | |
| if stderr: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The intent of this class is to display the layout of an object in | |
| // memory. | |
| // Compile with: | |
| // clang -cc1 -x c++ -v -fdump-record-layouts test.cc -emit-llvm -o /dev/null | |
| // | |
| // | |
| //*** Dumping AST Record Layout | |
| //0 | struct Top | |
| //0 | int a | |
| //| [sizeof=4, dsize=4, align=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Requirements: | |
| # clang - The classes/structs you want to dump must be used in code at least once, not just defined. | |
| # MSVC - The classes/structs you want to dump must have "MEOW" in the name for "reportSingleClass" to work. | |
| # Usage: | |
| # $ make dump_vtables file=test.cpp | |
| dump_vtables: | |
| clang -cc1 -fdump-record-layouts -emit-llvm $(file) > clang-vtable-layout-$(file).txt | |
| clang -cc1 -fdump-vtable-layouts -emit-llvm $(file) > clang-record-layout-$(file).txt | |
| g++ -fdump-lang-class=$(file).txt $(file) | |
| cl.exe $(file) /d1reportSingleClassLayoutMEOW > msvc-single-class-vtable-layout-$(file).txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REM AST generation from MSVC | |
| cl /analyze /d1Aprintast %1 > %1.ast |