Skip to content

Instantly share code, notes, and snippets.

@acceptable-security
acceptable-security / bad_datalog.py
Created June 26, 2021 02:49
A really shoddy datalog engine I wrote in a few minutes
from dataclasses import dataclass, field
from typing import Dict, Generator, List, Tuple, Union
@dataclass(frozen=True)
class Constant():
value: Union[int, str, float]
def __str__(self) -> str:
return str(self.value)

Keybase proof

I hereby claim:

  • I am block8437 on github.
  • I am avisaven (https://keybase.io/avisaven) on keybase.
  • I have a public key ASCIoGO93yi4yuWml7a58iCpQtTOuIs1Uh56iYbWA6GLEQo

To claim this, I am signing this object:

a) Left Left Case
T1, T2, T3 and T4 are subtrees.
z y
/ \ / \
y T4 Right Rotate (z) x z
/ \ - - - - - - - - -> / \ / \
x T3 T1 T2 T3 T4
/ \
T1 T2
T1, T2, T3 and T4 are subtrees.
z y
/ \ / \
y T4 Right Rotate (z) x z
/ \ - - - - - - - - -> / \ / \
x T3 T1 T2 T3 T4
/ \
T1 T2
function isPrime(n) {
for ( let i = 2; i < n / 2; i++ ) {
if ( n % i == 0 ) {
return false;
}
}
return true;
}
fn _main() : int {
var ayy : int = 2;
if ( ayy == 2 ) {
if ( ayy < 4 ) {
ayy = 0;
}
}
return ayy;
.global _main
_main:
PUSH %EBP
MOVL %ESP, %EBP
PUSH $2
POP %EAX
MOV %EAX, -4(%EBP)
PUSH $2
MOV -4(%EBP), %EAX
PUSH %EAX

Keybase proof

I hereby claim:

  • I am block8437 on github.
  • I am briansmith (https://keybase.io/briansmith) on keybase.
  • I have a public key whose fingerprint is B527 4127 F3BC 8CD6 50FD E5D2 1A9B 3CCE 8B0F E520

To claim this, I am signing this object:

@acceptable-security
acceptable-security / Makefile
Created December 7, 2014 18:05
A general usage Makefile for c/c++
# Brian Smith's Super Duper Makefile
# Change CC/CFLAGS/LDFLAGS to fit your needs
# Directory format it searchs for:
# src/ - have your .c/.cc/.cpp files in there
# include/ - have your .h/.hpp files in there
# build/ - empty folder for object files and the executable
# CHANGE THESE TO FIT YOUR NEEDS
CC = cc
CFLAGS = -c -Wall -Iinclude/
def sbin(toPrint):
return "{:0b}".format(toPrint)
class OctNode:
def __init__(self, parentNode, data):
self.parentNode = parentNode
#self.position = position
self.data = data
self.leaf = True