Skip to content

Instantly share code, notes, and snippets.

View Cryolitia's full-sized avatar
🏳️‍⚧️
三天摸鱼,两天晒网

PukNgae Cryolitia Cryolitia

🏳️‍⚧️
三天摸鱼,两天晒网
View GitHub Profile
@Cryolitia
Cryolitia / hash_table.c
Created October 22, 2021 11:41
Verify Goldbach's conjecture
//
// Created by Neuron on 2021/10/20.
//
#include "hash_table.h"
HashTable *initHashTable(uint64_t size) {
HashTable *hashTable = (HashTable *) malloc(sizeof(HashTable));
hashTable->count = size;
hashTable->node = (Node **) calloc(size, sizeof(Node *));
@Cryolitia
Cryolitia / RegexUTF-8.c
Last active October 12, 2023 12:59
Regex single UTF-8 Character in std::string
#include <iostream>
#include <regex>
int main() {
std::string input = "你好,world!";
std::smatch matches;
auto regex = std::regex("([\\x00-\\x7F]|([\\xC0-\\xF7][\\x80-\\xBF]*))");
std::sregex_iterator begin(input.begin(),input.end(),regex);
std::sregex_iterator end;
for (auto i = begin;i!=end;++i) {
@Cryolitia
Cryolitia / solve.cpp
Created January 16, 2024 00:09
Solving Sudoku puzzles based on customized information entropy
//
// Created by cryolitia on 24-1-16.
//
#include <iostream>
#include <vector>
#include <utility>
#include <unordered_set>
#include <cassert>
#include <memory>
@Cryolitia
Cryolitia / sig2dot.py
Last active April 5, 2024 14:51
sig2dot.py
# Visualize GnuPG Trust Web
# usage: gpg --list-sigs | python3 ./sig2dot.py
import fileinput
import re
import networkx
from matplotlib import pyplot
lines = [i for i in fileinput.input() if not i.startswith('sub')]
# lines = [i for i in open("gpg.txt", "r").readlines() if not i.startswith('sub')]