Skip to content

Instantly share code, notes, and snippets.

Badel2

Block or report user

Report or block Badel2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Badel2
Badel2 / hello_world.py
Created Nov 21, 2018
Hello world in python
View hello_world.py
#!/usr/bin/env python3
import random
random.seed(0x230f9ab296eb91053876d5fdcd15b7b989a12fd4451927196eafd39502b4487571ab839da616c9caea2089dd52e5219b809b5f735aadcec7dde80a96c2714b36b5f192fd1cdb3732994d0c5385ebb51a828d31205678b8eac7ab75a18c1b259ee18c986336fb38fb313e37b8*16**3168+1)
print("".join([chr(32+int(random.random()*96)) for i in range(13)]))
@Badel2
Badel2 / codegolf_173977.rs
Last active Oct 19, 2018
Describe a 2D Bitmap Using Filled Rectangle Mapping
View codegolf_173977.rs
// https://codegolf.stackexchange.com/questions/173977/describe-a-2d-bitmap-using-filled-rectangle-mapping#173977
// Badel2
extern crate rand;
use rand::{Rng, thread_rng};
#[derive(Copy, Clone, Debug)]
struct Rect {
x0: usize,
y0: usize,
View prime_circles.py
#!/usr/bin/env python3
from pprint import pprint
from itertools import compress
from math import sqrt, inf, gcd
from random import randrange
import sys
# prime_circles.py: Find primes that form circles
# https://math.stackexchange.com/questions/2886024/a-conjecture-involving-prime-numbers-and-circles
# https://www.reddit.com/r/math/comments/98ie5z/a_conjecture_involving_prime_numbers_and_circles/
View comphdl-02.rs
#[derive(Debug, Copy, Clone, PartialEq)]
enum Bit {
L, // Low, false, 0
H, // High, true, 1
X, // Undefined
}
trait Component: std::fmt::Debug {
fn update(&mut self, input: &[Bit]) -> Vec<Bit>;
fn num_inputs(&self) -> usize;
@Badel2
Badel2 / nand_comp.rs
Last active Feb 14, 2018
Implementing an OR gate from NAND gates https://badel2.github.io/comphdl-01
View nand_comp.rs
#![allow(dead_code)]
#[derive(Debug, Copy, Clone, PartialEq)]
enum Bit {
L, // Low, false, 0
H, // High, true, 1
}
trait Component {
fn update(&mut self, input: &[Bit]) -> Vec<Bit>;
@Badel2
Badel2 / spectre.c
Last active Mar 4, 2019
Spectre attack example implementation
View spectre.c
/* https://spectreattack.com/spectre.pdf */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
You can’t perform that action at this time.