Skip to content

Instantly share code, notes, and snippets.

View nmmmnu's full-sized avatar

Nikolay Mihaylov nmmmnu

View GitHub Profile

Activate Windows 8, 8.1, 10 and 11 Pro for Free

A guide how to get and activate Windows 8, 8.1, 10 and 11 Pro for free!

NOTE

If you see the Windows keyboard button in this guide; and you can't find it on your keyboard, you likely have/had Windows 10 which has the button . If you can't find that one, you likely have a PC that has been upgraded to Windows 8/8.1/10/11 from Windows 8.1/8/7/Vista/XP and other ones. If you have one of those, refer the Windows key button to as yours. A list of them is below:

Windows key buttons

- Windows 11

- Windows 10

from polygenerator import random_polygon
import matplotlib.pyplot as plt
def is_inside(edges, xp, yp):
cnt = 0
for edge in edges:
(x1, y1), (x2, y2) = edge
if (yp < y1) != (yp < y2) and xp < x1 + ((yp-y1)/(y2-y1))*(x2-x1):
cnt += 1
@nmmmnu
nmmmnu / hyperloglog.cc
Last active September 30, 2022 09:57
High performance HyperLogLog for HM4
#include "hyperloglog.h"
#include "murmur_hash_64a.h"
#include <cmath>
namespace{
uint32_t getLeadingbits(uint64_t const hash, uint8_t bits){
return uint32_t( hash >> (64 - bits));
}
@nmmmnu
nmmmnu / main.cc
Created September 8, 2022 13:50
MD5
#include "md5.h"
#include <cstdio>
#include <cstdlib>
int main(int argc, char **argv) {
if (argc < 2) {
printf("usage: %s 'string'\n", argv[0]);
return 1;
}
@nmmmnu
nmmmnu / pi.2021.cc
Last active March 12, 2021 11:33
pi.2021.cc
#include <cstdio>
using myfloat = double;
constexpr size_t MAX = 2'500'000'000;
int main(){
myfloat sum = 0;
myfloat const four = 4;
#include <cstdint>
#include <utility>
namespace convertor{
constexpr uint16_t MAX_KEY = 0b00000000'00000011'11111111; // 1023
constexpr uint32_t MAX_VAL = 0b00111111'11111111'11111111; // 4'194'303
constexpr
uint16_t val_i16(uint16_t, uint32_t const val){
return val & 0b11111111'11111111;
#define _GNU_SOURCE
#include <fcntl.h> // open
#include <stdlib.h> // fallocate
#include <stdio.h>
inline void err(const char *msg){
perror(msg);
exit(1);
}
@nmmmnu
nmmmnu / pi.cc
Created March 14, 2020 10:04
PI day 2020
#include <cstdio>
using myfloat = double;
constexpr size_t MAX = 500'000'000;
int main(){
myfloat pi = 0;
myfloat sign = +1;
drop table if exists users;
create table users(
id int primary key,
up int,
up_dir enum('L','R'),
lc int,
rc int,
@nmmmnu
nmmmnu / test_iterator.cc
Created November 24, 2018 17:59
Iterator traits
#include <iterator>
#include <numeric>
class array{
int d[5] = { 1, 2, 3, 4, 5 };
public:
struct it{
// traits section