Skip to content

Instantly share code, notes, and snippets.

@Yepoleb
Yepoleb / intersect.cpp
Created January 15, 2020 04:58
Check if two rectangles intersect
#include <xmmintrin.h>
#include <stdint.h>
struct alignas(16) Rect
{
float left;
float right;
float top;
float bottom;
};
summands = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]
def rowsum(row):
s = 0
for x in row:
s += summands[x]
return s
valid_sum = rowsum([1, 2, 3, 4, 5, 6, 7, 8, 9])
summands = [1]
for i in range(9):
summands.append(summands[-1] * 10)
def rowsum(row):
return sum(summands[x] for x in row)
valid_sum = rowsum([1, 2, 3, 4, 5, 6, 7, 8, 9])
def is_sudokurow(row):
PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61]
def rowproduct(row):
p = 1
for x in row:
p *= PRIMES[x]
return p
valid_product = rowproduct([1, 2, 3, 4, 5, 6, 7, 8, 9])
@Yepoleb
Yepoleb / subi.py
Last active November 15, 2019 20:35
import random
import string
vowels = "aeiou"
consonants = list(set(string.ascii_lowercase) - set(vowels))
def subify(subi):
base_subi = list(subi)
r = random.random()
if r <= 0.3:

OTP Transaction Log

  • Card: Raiffeisen Debit Card from 2017
  • Tangenerator: Gemalto CardTan
  • PIN: 00000
  • Generated TAN: 2879410
  • Standard: CAP-HHD

Unknown

@Yepoleb
Yepoleb / ytmusic.py
Last active September 30, 2024 08:19
Youtube Music downloader with automatic ID3 tagging. Uses mutagen and requests.
#!/usr/bin/env python3
# License: GPLv3
import re
import json
import shutil
import subprocess
import sys
import urllib.parse
#!/usr/bin/env python3
import mistune
import sys
import os.path
import tempfile
import subprocess
XSL_PATH = os.path.expanduser("~/Coden/xml/outline-tmpl.xsl")
TEMPLATE = \
.intel_syntax noprefix
.section .rodata
FORMAT_STRING:
.string "%d %d\n"
.section .text
splittable64:
// rdi: x
// rax: a
@Yepoleb
Yepoleb / ramem.c
Last active February 14, 2019 01:59
/*
* Experiment to use a very big array as a fixed size heap and store
* values by indexing it with the hash of their name
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#define RAMEM_SIZE ((size_t)1048576 * 1024)