Skip to content

Instantly share code, notes, and snippets.

Avatar

Badgateway badgateway666

View GitHub Profile
View hello_world.py
list(map(print, map(lambda n : (chr(0x0).join(chr(x) for x in (int(n[3 * i:3 * i + 3]) for i in range(0, len(n) // 3)))), [ "104101108108111", "119111114108100" ])))
@badgateway666
badgateway666 / base64.rs
Last active Aug 10, 2020
base64 encoding implemented in rust
View base64.rs
pub fn hex2b64(s: &str) -> String {
assert_eq!(s.len() % 2, 0);
let bit_mask1 = 0x00FC_0000;
let bit_mask2 = 0x0003_F000;
let bit_mask3 = 0x0000_0FC0;
let bit_mask4 = 0x0000_003F;
let excess_bytes = s.len() / 2 % 3;
let mut buf = String::new();
@badgateway666
badgateway666 / incremental_timer.py
Last active Dec 23, 2019
Timer which updates average delay between measurements incrementally
View incremental_timer.py
import time
class Incremental_Timer(object):
def __init__(self):
self.start_time = time.time()
self.count_measurement = 0
self.current_avg = 0
self.prev_time = None
self.current_time = None
self.initialized = False
@badgateway666
badgateway666 / mandelbrot.py
Created Dec 23, 2019
Generate mandelbrot image from csv pixel data
View mandelbrot.py
import math
from PIL import Image
import pandas as pd
import time
RESOLUTION = 10**3
def get_color(escape_val):
return escape_val
@badgateway666
badgateway666 / media.sh
Created Dec 12, 2019
Media-Player Interface with fzf
View media.sh
#!/usr/bin/env bash
selection=$(ls -d ~/Musik/* ~/Videos/* | fzf )
cvlc "$selection"
View megaman.sh
#!/bin/bash
if [ $# -lt 1 ]; then
selection=$(man -k . | fzf | cut -f1 -d " ")
if [ -z selection ]; then
exit
fi
if man "$var" > /dev/null 2>&1
then
man -Tpdf "$var" | zathura - &
fi
@badgateway666
badgateway666 / Series.py
Last active Sep 8, 2019
Sum fun. (BADUMTSS) v1
View Series.py
import random
from math import sqrt
import numpy as np
def harmonic_series(stop_after=-1):
"""
:param stop_after:
:return:
"""
@badgateway666
badgateway666 / matrix_multiply.py
Created Aug 26, 2019
Matrix multiplication v1
View matrix_multiply.py
def matrix_multiply(m_1, m_2):
assert len(m_1[0]) == len(m_2)
r = list(map(lambda m: sum([x * y for x, y in zip(*m)]), [(x, y) for x in m_1 for y in zip(*m_2)]))
return [r[x:x+len(m_2[0])] for x in range(0, len(m_1)*len(m_2[0]), len(m_2[0]))]
@badgateway666
badgateway666 / Vector.py
Last active Jan 29, 2019
My vector implementation taking advantage of python's built-in Magic-Methods
View Vector.py
import math
import numbers
import random
class Vector(object):
""" My pythonic vector implementation """
def __init__(self, *args):
if len(args) == 1 and isinstance(args[0], list):
View keybase.md

Keybase proof

I hereby claim:

  • I am cronixx on github.
  • I am crnxx (https://keybase.io/crnxx) on keybase.
  • I have a public key ASBCvsaTsBny7CsOxj-DlozgjzLTDm7EN8oobblXbpjaQAo

To claim this, I am signing this object:

You can’t perform that action at this time.