Skip to content

Instantly share code, notes, and snippets.

@rHermes
rHermes / 2015-day4.cpp
Created November 15, 2021 21:55
Doing advent of code 2015 day 4 with https://github.com/intel/isa-l_crypto to try t oget it as fast as possibe
#include <string_view>
#include <cstdio>
#include <cstdlib>
#include <fmt/core.h>
#include <fmt/format.h>
#include <md5_mb.h>
#include <endian_helper.h>
@rHermes
rHermes / TrueColour.md
Created May 27, 2020 09:17 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
{"id":"8819736634"}
{"id":"8819736636"}
{"id":"8819736637"}
{"id":"8819736638"}
{"id":"8819736639"}
{"id":"8819736640"}
{"id":"8819736642"}
{"id":"8819736644"}
{"id":"8819736648"}
{"id":"8819736651"}
package main
import (
"bufio"
"fmt"
"io"
"log"
"math/rand"
"net"
"net/http"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
int main() {
int x, y, n;
unsigned char *data = stbi_load("testimage.jpg", &x, &y, &n, 3);
; Created by rHermes (2017.03.14 12:36:40 UTC)
;
; This was made so that I could use the ingame code editor in the very cool
; game called "liberation-circut"[1]. It has only been minimally tested so
; please fork and share your improvements!
;
; [1] - [https://github.com/linleyh/liberation-circuit]
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
// 2013-4-toerrskodd-moetevirksomhet.cpp
#include <iostream>
#include <set>
#include <vector>
#include <sys/types.h>
#include <limits>
#include <algorithm>
#include <utility>
#include <stack>
@rHermes
rHermes / PyOverflow.py
Created November 3, 2013 15:30
This was an experiment, trying to parse the XML dump of stackoverflow into a mysql database. Unfortuently, the script failed once the XML dumps got large enough.
from lxml import etree
import pymysql
def fast_iter(context, func):
for event, elem in context:
func(elem)
elem.clear()
while elem.getprevious() is not None:
del elem.getparent()[0]
del context
def HMP(n):
x = 2
z = []
while x <= n//2:
while n % x == 0:
n //= x
z.append(x)
x += 1
if n is not 1:
#!/usr/bin/env python2
# Written by Alexogo and rHermes
print('Welcome to the QSL Login site, please enter your credentials.')
#TODO: Hash these passwords, as this could be read straight from memory.
logins = {
"QSL Alexogo": "Test01",
"QSL Viper": "Test02",