Skip to content

Instantly share code, notes, and snippets.

View AlphaHot's full-sized avatar
🎯
Focusing

AlphaHot

🎯
Focusing
  • // TODO
  • Canada
View GitHub Profile
//go:build ignore
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
@AlphaHot
AlphaHot / fs.go
Created September 10, 2024 08:41
//go:build ignore
package main
import (
"fmt"
"html"
"io/ioutil"
"log"
"mime"
@AlphaHot
AlphaHot / Top_Public_Time_Servers.md
Created July 29, 2024 11:08 — forked from mutin-sa/Top_Public_Time_Servers.md
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

@AlphaHot
AlphaHot / RC4.c
Created July 12, 2024 17:56 — forked from rverton/RC4.c
/*
robin verton, dec 2015
implementation of the RC4 algo
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 256 // 2^8
@AlphaHot
AlphaHot / FreeCHR.py
Created January 1, 2024 05:12 — forked from SRechenberger/FreeCHR.py
Example Instances of FreeCHR
from itertools import permutations
def match(pattern, constraints):
return (perm
for perm in permutations(constraints, len(pattern))
if all(p(c) for p, c in zip(pattern, perm))
)
@AlphaHot
AlphaHot / Boolean Algebra for Programmers in a Nutshell.md
Created February 27, 2023 08:37 — forked from Ustice/Boolean Algebra for Programmers in a Nutshell.md
Boolean Algebra in a nutshell for JS/TS programmers

Boolean Algebra in a nutshell for JS/TS programmers

There are a lot of strategies that you will hear about in the Javascript community for keeping your conditionals from becoming a tangled mess. This isn't like them. This is someting different. MATH! Boolean Algebra to be exact. I use it all the time to simplify complex conditionals. There are two things that you need to know: de Morgan's Theorem, and Karnaugh (pronounced CAR-no) Maps. (Don't worry, there is no test)

de Morgan's Theorem

De Morgan's Theorem is great distributing nots (!), and for when you want to convert an && to an ||, or back. This is it:

 !(A &amp;&amp; B) = !A || !B
@AlphaHot
AlphaHot / todd_coxeter.py
Created August 23, 2022 15:34 — forked from james-d-mitchell/todd_coxeter.py
An implementation of the Todd-Coxeter Algorithm for Semigroups and Monoids in python3
#!/usr/bin/env python3
class ToddCoxeter:
def __init__(self):
self.nodes = [0]
self.edges = None
self.kappa = []
self.next_node = 1
self.R = []
@AlphaHot
AlphaHot / vimModeStateDiagram.svg
Created November 18, 2021 07:39 — forked from darcyparker/vimModeStateDiagram.svg
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def cntBit(num):
return len(bin(num)) - 2
print(cntBit(0xFFFFFFFF)) # 32
free_entry **fe;
for (
fe = &first_free_entry;
(*fe)->next &&
(
reinterpret_cast <char *> ((*fe)->next) >
reinterpret_cast <char *> (e) + sz
);
fe = &(*fe)->next