This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from PIL import Image | |
import pandas as pd | |
import time | |
RESOLUTION = 10**3 | |
def get_color(escape_val): | |
return escape_val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
selection=$(ls -d ~/Musik/* ~/Videos/* | fzf ) | |
cvlc "$selection" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from math import sqrt | |
import numpy as np | |
def harmonic_series(stop_after=-1): | |
""" | |
:param stop_after: | |
:return: | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ]))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def PromptUser(prompt): | |
yield input(prompt) | |
def LoopGen(gen, *args, **kwargs): | |
while True: | |
for item in gen(*args, **kwargs): | |
yield item | |
NewerOlder