Skip to content

Instantly share code, notes, and snippets.

View CptTZ's full-sized avatar
😆
Hi

ItchyZ CptTZ

😆
Hi
  • ZSNJ, KPIT, KSEA, KSFO
View GitHub Profile
@CptTZ
CptTZ / crc_calc.py
Created April 1, 2019 22:44
CRC Calculation in Python 3
def crc_remainder(input_bitstring, polynomial_bitstring, initial_filler):
'''
Calculates the CRC remainder of a string of bits using a chosen polynomial.
initial_filler should be '1' or '0'.
'''
polynomial_bitstring = polynomial_bitstring.lstrip('0')
len_input = len(input_bitstring)
initial_padding = initial_filler * (len(polynomial_bitstring) - 1)
input_padded_array = list(input_bitstring + initial_padding)
while '1' in input_padded_array[:len_input]:
input: "image"
input_dim: 1
input_dim: 3
input_dim: 1 # This value will be defined at runtime
input_dim: 1 # This value will be defined at runtime
layer {
name: "conv1_1"
type: "Convolution"
bottom: "image"
top: "conv1_1"
@CptTZ
CptTZ / Java-RC4
Created November 18, 2018 03:50 — forked from songzhiyong/Java-RC4
public class RC4 {
private final byte[] S = new byte[256];
private final byte[] T = new byte[256];
private final int keylen;
public RC4(final byte[] key) {
if (key.length < 1 || key.length > 256) {
throw new IllegalArgumentException(
"key must be between 1 and 256 bytes");
} else {
<script type="text/javascript">
if (document.location.protocol != "https:") {
location.href = location.href.replace(/^http:/,"https:");
}
</script>