Skip to content

Instantly share code, notes, and snippets.

View caffeinatedgaze's full-sized avatar
💪

Mikhail Liamets caffeinatedgaze

💪
View GitHub Profile
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
BITMASK32 = int('0xffffffff', 16)
def hash_name(name):
if any([ord(x) < ord('A') for x in name]):
return 1
out = []
for each in name:
# exercise 2, generating shared key
from tinyec import registry
import secrets
curve = registry.get_curve('brainpoolP256r1')
def compress_point(point):
return hex(point.x) + hex(point.y % 2)[2:]
@caffeinatedgaze
caffeinatedgaze / ec-exercise1.py
Last active October 29, 2020 11:06
Exercises for lab 3 on EC
import math
import libnum
def func(a, x, y, p=37):
return ((3 * x ** 2 + a) * libnum.invmod((2 * y), p)) % p
def pp(x1, a, b, p=37):
y = libnum.sqrtmod_prime_power((math.pow(x1, 3) + a * x1 + b) % p, p, 1)
package main
import (
"fmt"
"os"
"io"
)
type Tuple struct {
is_there bool;
function [H] = my_dft(signal)
len = length(signal)
H = zeros(1:len)
for i = 1:len - 1
for j = 1:len
H(i) = H(i) + signal(j) * exp(-2 * %i * %pi * j * i / len)
end
@caffeinatedgaze
caffeinatedgaze / cancelling-effects.sci
Last active April 13, 2020 20:55
Digital FIR Filter Design
close() ; close(); clear()
function [H] = compute_irc(signal)
// spectrum = real(fft(signal));
H = signal .* window('kr', length(signal), 16);
endfunction
function [out] = compute_inv_irc(signal)
filter_fft = fft(signal)
@caffeinatedgaze
caffeinatedgaze / alice.py
Created October 2, 2019 20:35
Distributed Systems Lab on Socket Communication
#!/usr/bin/python3
from socket import \
socket, \
AF_INET, \
SOCK_STREAM, \
SOL_SOCKET, \
SO_REUSEADDR
from selectors import DefaultSelector, EVENT_READ
from sys import argv, stderr
from threading import Thread