Skip to content

Instantly share code, notes, and snippets.

@hoenirvili
hoenirvili / main.c
Last active December 3, 2020 10:36
euclidian algorithm, linear diophantine and linear_congruential equation solver
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <errno.h>
typedef struct pair{
int alpha;
int beta;
#!/bin/bash
# DEFAULTS
BRANCH=master
BUILDWIN=true
BUILDUNIX=true
while [[ $# > 0 ]]
do
key="$1"
@hoenirvili
hoenirvili / kmeans.py
Last active January 17, 2018 19:11
kmeans
#!/usr/bin/env python3
import abc
import math
import random
class Point(metaclass=abc.ABCMeta):
def __init__(self, coordinate):
if not isinstance(coordinate, float) and not isinstance(
@hoenirvili
hoenirvili / data.csv
Created November 9, 2017 17:10
naive bayes
x1 x2 y
0 0 0
0 0 0
0 0 1
0 0 1
0 0 1
0 0 1
0 0 1
0 0 1
0 0 1
@hoenirvili
hoenirvili / Makefile
Last active November 7, 2017 13:56
id3 algorithm
all:
./id3.py data.csv
graph:
./graph.py data.csv
@hoenirvili
hoenirvili / reverse_hashcode_exploit.py
Created June 24, 2017 12:52
CTF reverse hashcode
#!/usr/bin/python
import subprocess
# decode_hashcode into even blocks such that the
# the sum of those are the final hash code
def decode_hashcode(hashcode, iterations):
decoded = []
if hashcode % iterations == 0:
@hoenirvili
hoenirvili / youtube-download.sh
Created June 8, 2017 17:14
Youtube downloader playlist script
#!/bin/sh
echo -e '\033]0;'YouTube MP3 Downloade'\007'
clear
echo Enter the number of threads:
read threads
echo Enter the link of the playlist you want to download:
read link
number=$(youtube-dl -s -f -1 $link | grep -Po '(?<=1 of ).*')
for ((i=0; i<$threads; i++))
do
@hoenirvili
hoenirvili / prod.sh
Created February 27, 2016 11:20
Golang production
# It will omit the DWARF symbol table during the build process.
go build -o gobin -ldflags=-w
# The -s ldflag will omit the symbol table and debugging information when building your executable.
go build -o gobin -ldflags=-s
# Compress bin with UPX
upx gobin
@hoenirvili
hoenirvili / client.go
Last active February 12, 2016 18:43
TCP File client server in go
package main
import (
"fmt"
"io"
"net"
"os"
)
const (
@hoenirvili
hoenirvili / Makefile
Last active January 30, 2016 13:17
ExASM
all:
nasm -f elf64 foo.asm -o foo.o
ld -o foo foo.o