Skip to content

Instantly share code, notes, and snippets.

View kukrimate's full-sized avatar

Máté Kukri kukrimate

View GitHub Profile
@kukrimate
kukrimate / t.py
Last active September 14, 2023 01:52
Enumerate all possible RSA plaintexts given a ciphertext, two primes p and q, and any integer e.
from Crypto.Util.number import GCD, bytes_to_long, long_to_bytes
class CRT:
def __init__(self, p, q):
self.p_p_inv = p * pow(p,-1,q)
self.p_q = p * q
def calc(self, a, b):
x = a + (b - a) * self.p_p_inv
return x % self.p_q
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
/* Round to the nearest power of 2 >= to size */
static inline size_t round_pow2(size_t size)
{
size_t newsize = 1;
@kukrimate
kukrimate / gram-schmidt.py
Created November 12, 2020 12:44
Orthogonal and orthonormal base calculator (linear algebra)
#!/usr/bin/python3
import sympy
from fractions import *
from copy import copy
def def_vec(n):
class vec:
def __init__(self, elements):
self.elements = [ Fraction(0) for i in range(n) ]

Keybase proof

I hereby claim:

  • I am kukrimate on github.
  • I am kukrimate (https://keybase.io/kukrimate) on keybase.
  • I have a public key ASDepDqI6kQNj30v7VUTrNJBSaimOPVT2VQmkLj5iH2BUQo

To claim this, I am signing this object:

@kukrimate
kukrimate / create_winusb.sh
Last active December 20, 2018 14:45
Easily create a Windows Vista/7/8 or 10 installer USB drive under Linux
#!/bin/sh
# Create a Windows Vista/7/8/10 USB installer from an ISO under Linux/Unix
if [ $UID -gt 0 ]; then
echo "You must run this as root" >&2
exit 1
fi
if [ "$#" -lt 1 ]; then
echo "Usage: create_winusb.sh <iso> [device]" >&2
@kukrimate
kukrimate / CleanWin.ps1
Created September 15, 2018 12:58
Script to make it easier to remove preinstalled crapware on windows 10
Get-AppxPackage | ForEach-Object {
$answer = Read-Host -Prompt "Do you want to remove $($_.Name)?"
if ($answer -like "y*") {
Remove-AppxPackage -Package $_.PackageFullName
}
}
@kukrimate
kukrimate / extorito.py
Created December 29, 2017 20:09
Small Python script to extract an hdd image from the Lenovo provided Bootable ISOs
import struct
import sys
import binascii
# ISO9660 block size
iso_blocksize = 0x800
# El Torito block
torito_block = 0x11
@kukrimate
kukrimate / musl-bootstrap.sh
Created February 13, 2017 19:48
musl-bootstrap.sh
#!/bin/bash
# This script builds a (hopefully) working gcc based cross compiler
# Update to latest stable release
BINUTILS_VERSION=2.27
GMP_VERSION=6.1.2
MPFR_VERSION=3.1.5
MPC_VERSION=1.0.3
ISL_VERSION=0.16.1
GCC_VERSION=6.3.0
@kukrimate
kukrimate / bootstrap.sh
Last active September 13, 2023 21:13
Create a cross gcc toolchain for any target! And it only builds everything once!
#!/bin/bash
# This script builds a (hopefully) working gcc based cross compiler
# Update to latest stable release
BINUTILS_VERSION=2.27
GMP_VERSION=6.1.2
MPFR_VERSION=3.1.5
MPC_VERSION=1.0.3
ISL_VERSION=0.16.1
GCC_VERSION=6.3.0
@kukrimate
kukrimate / pybus.py
Created November 25, 2016 16:22
BKK busz menetrend figyelo szkript
#!/usr/bin/env python3
import sys
import argparse
import requests
import json
import time
import datetime
def getBusDepartures(stopCode):