Skip to content

Instantly share code, notes, and snippets.

View gynvael's full-sized avatar

Gynvael Coldwind gynvael

View GitHub Profile
@gynvael
gynvael / num2.py
Created August 10, 2018 10:43
Vlog #012 files
M = [13023, 201527, 4294967291]
N = [
21179556,5337795,18437072,
11383457,16076557,13286032,
37655692,471675,21030418,
33533337,9666873,6884524,111490,
18371648
]
mm = ""
@gynvael
gynvael / comp_A.zip.nasm
Created August 10, 2018 12:16
Additional "ZIP source" files (build with nasm)
; So... what would happen if the compressed size mismatches
; uncompressed size in a *compressed* file? Let's find out!
; Note, there are three variants here:
; A - only Local File Header has mismatched sizes.
; B - only Central Directory has mismatched sizes.
; C - both have mismatched sizes.
;
; This is variant: A
;
; by gynvael.coldwind//vx
@gynvael
gynvael / Loader.asm
Created January 23, 2019 11:20
32-bit PE loader from OSAmber (part of bootloader)
[bits 16]
[org 0x0]
%define SEGMENT_PHYSICAL_ADDR 0x20000
%define SEGNO(segno,ti,rpl) (segno*8+ti*4+rpl)
%define PADDR(a) (a+SEGMENT_PHYSICAL_ADDR)
%define PEIMAGE_PADDR 0x20200
%define IDOSH_LFANEW 0x3C
%define IOPTH_IMGSIZE 0x50
%define IOPTH_IMGBASE 0x34
@gynvael
gynvael / notes
Created April 22, 2019 18:42
nasm + MinGW gcc test
gynvael:haven-windows>nasm test.asm -f win64 -o test.obj && gcc test.obj
gynvael:haven-windows>a.exe
// this actually shows the message box
gynvael:haven-windows>gcc --version <----------------------------- make sure you have a 64-bit mingw gcc
if you don't, go to [1] and get mingw-w64-install.exe file
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
@gynvael
gynvael / fib_test.py
Created October 19, 2019 18:01
Gynvael's test code for the circuit described in the "Designing adder circuit for Fibonacci representation" article by Tomasz Idziaszek
import sys
N=15
fib = [0, 1]
for i in xrange(2, N + 2):
fib.append(fib[i-1] + fib[i-2])
del fib[0]
del fib[0]
print fib
#include <cstdio>
#include <iostream>
#include <string>
class Rectangle {
private:
int a;
int b;
public:
generalnie jeśli chodzi o szukanie rzeczy do assemblera, to musisz zdecydować się na 3 rzeczy:
1) architekturę
2) system operacyjny
3) konkretny assembler
i szukać tutoriali pod te 3 rzeczy
1) w Twoim wypadku to x86-64 aka AMD64 aka x64
aka 86 64-bit
2) hmmm Linux? czy Windows? jak wolisz?
[dla linuxa]
3) do wyboru jest nasm, yasm albo gnu as
@gynvael
gynvael / test.py
Created May 25, 2020 09:06
Removing elements from list based on condition benchmark
#!/usr/bin/python3
"""
Results:
--- Remove if number is evenly dividable by 2
1.2708177
1.2841774
0.667672
--- Remove if number is evenly dividable by 3
@gynvael
gynvael / jsonschema_int_validation.py
Created June 22, 2020 18:16
Testing integer validation based on another field's value in JSON Schema Draft 7 (Python 3)
import json
import jsonschema
schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [ "tens", "hundreds" ]
@gynvael
gynvael / devpath_check.cc
Created February 3, 2021 21:27
Check if device path exists on Windows
#include <Windows.h>
#include <stdio.h>
#include <string>
using std::string;
void testdev(string devname) {
string path = "\\\\?\\Global\\GLOBALROOT\\Device\\" + devname;
printf("----------------- %s\n", devname.c_str());