Skip to content

Instantly share code, notes, and snippets.

@x0nu11byt3
x0nu11byt3 / Karatsuba.cpp
Created October 6, 2025 05:19
Karatsuba
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
class Karatsuba {
private:
// Remove leading zeros
static string stripZeros(const string &num) {
size_t pos = num.find_first_not_of('0');
@x0nu11byt3
x0nu11byt3 / TernarySearch.cpp
Created October 6, 2025 05:17
TernarySearch
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
class TernarySearch {
private:
vector<int> data; // sorted data
int comparisons; // count comparisons
@x0nu11byt3
x0nu11byt3 / BinarySearch.cpp
Created October 6, 2025 04:11
BinarySearch
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
class BinarySearch {
private:
vector<int> data; // Sorted array
int comparisons; // Count of comparisons
@x0nu11byt3
x0nu11byt3 / keybase.md
Created January 19, 2024 00:04
Keybase proof

Keybase proof

I hereby claim:

  • I am x0nu11byt3 on github.
  • I am x0nu11byt3 (https://keybase.io/x0nu11byt3) on keybase.
  • I have a public key whose fingerprint is 3611 378E 9F55 2535 7C14 C28E 7FB2 0695 50E8 9AF0

To claim this, I am signing this object:

@x0nu11byt3
x0nu11byt3 / equivalent_modulo.c
Created December 22, 2023 10:28
In c, you could subtract 1 and do a bitwise-and. to make the calculation equivalent to the modulo.
#include <stdio.h>
#include <stdlib.h>
int main ( int argc, char** argvs ) {
int a = -127;
int b = 4;
int mod_ = a % b;
int mod_alt_a = a - b * ( a / b );
// mod_alt works as alternative to modulo
int mod_alt = a & ( b - 1 );
@x0nu11byt3
x0nu11byt3 / fsec_solve.py
Created July 7, 2023 06:48 — forked from LiveOverflow/fsec_solve.py
Fsec2017 z3 solution
from z3 import *
import struct
# calculate e,f,d for a given input password
def calc(m):
e = 0
f = 0
d = 0
for i in xrange(0, len(m)):
c = ord(m[i])
@x0nu11byt3
x0nu11byt3 / file_struct_employee.c
Created June 30, 2022 00:38
Read a simple struct employee write in c
#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 50
typedef struct {
int key;
char name[MAX_SIZE];
char departament[MAX_SIZE];
char category[MAX_SIZE];
float antiquity;
@x0nu11byt3
x0nu11byt3 / memo_en.md
Created June 4, 2022 04:39
Advent Calendar CTF 2014 の write-up。ブログに移動しました -> https://st98.github.io/diary/posts/2014-12-26-adctf.html

Advent Calendar CTF 2014

Aditional note: This is a translated version of the original project gist.github.com/st98/memo.md

We participated as Bok Team omakase. The final score was 173 points and the team was ranked 24th (out of 505 teams). We solved the problems on days 1 to 14, 21 to 22 and 25.

1 warmup (misc)

'0x41444354465f57334c43304d335f37305f414443374632303134'.match(/[0-9a-f]{2}/g).map(function(c){return String.fromCharCode(parseInt(c, 16))}).join('');
@x0nu11byt3
x0nu11byt3 / sshclient.py
Created June 4, 2022 04:32
SSH Client with a simple connection and run an simple command. For to connect with a normal user without many privileges since to use the root user more processes. Iptables to open a port is enabled as follows: iptables -A INPUT -p tcp -m tcp --dport <port> -j ACCEPT
#!/usr/bin/env python3
import os
import sys
import paramiko
class SSHClient:
def __init__(self,hostname, port, username, password):
self._port = port
@x0nu11byt3
x0nu11byt3 / gaussjordan.py
Created June 4, 2022 04:30
A simple implementation of the algorithm pure MethodGaussJordan Is a linear algebra algorithm used to determine the solutions of a system of linear equations Previous requirements for handling complex arrays you need to install numpy
#!/usr/bin/env python3
import numpy as np
class error(Exception): pass
class GaussJordan():
def __init__(self,x,y):
self.m = x
self.n = y
self.matrix = [[ 0 for i in range(x)] for j in range(y)]