This file contains 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 python3.5 | |
import socket | |
import asyncio | |
from struct import pack, unpack | |
class Client(asyncio.Protocol): | |
def connection_made(self, transport): | |
self.transport = transport | |
self.server_transport = None |
This file contains 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 torch | |
from torch import nn | |
# import torch_mlir | |
from torch_mlir.passmanager import PassManager | |
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder | |
torch.manual_seed(42) |
This file contains 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 torch | |
from torch import nn | |
import numpy as np | |
# https://github.com/arasdar/DL/blob/master/uri-dl/uri-dl-hw-2/assignment2/cs231n/layers.py | |
# https://github.com/brandontrabucco/conv-python/blob/master/main.py | |
def get_output_shape(x, kernel, stride): | |
(_, _, ih, iw), (kh, kw) = x.shape, kernel | |
oh = (ih - kh) // stride + 1 |
This file contains 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
#include <algorithm> | |
#include <cassert> | |
#include <random> | |
#include <vector> | |
constexpr unsigned int bit_floor(unsigned int num) { | |
return num == 0 ? 0 : 1 << (31 - __builtin_clz(num)); | |
} | |
template <typename It, typename T, typename Cmp> |
This file contains 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 python3 | |
import requests | |
prefix = 'https://api.telegram.org/bot' | |
key = '' | |
geturl = prefix + key + '/getUpdates' | |
sendurl = prefix + key + '/sendMessage' | |
timeout = 60 | |
This file contains 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 python3 | |
import sys | |
import clang.cindex | |
INDENT = 4 | |
K = clang.cindex.CursorKind | |
def is_std_ns(node): | |
return node.kind == K.NAMESPACE and node.spelling == 'std' |
This file contains 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 eyed3 | |
import re | |
import glob | |
def get_lyric(lrc): | |
text = open(lrc).read() | |
text = re.sub(r'(?:\[.*\])+', '', text).strip() | |
text = map(lambda l: l.strip(), text.split('\n')) | |
ans = [] | |
for l in text: |
This file contains 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 numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
from transforms3d import euler | |
fig = plt.figure() | |
ax = fig.gca(projection='3d') | |
p1 = np.zeros((3, 100)) | |
p1[0, :] = np.linspace(1, 3, 100) |
This file contains 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
#include <algorithm> | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <vector> | |
#include <optional> | |
#include <iomanip> | |
enum class Type { | |
PositionalArgument, |
This file contains 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 cv2 | |
import cv2.cv as cv | |
import tesseract | |
def show(im): | |
msg = 'press any key to continue' | |
cv2.namedWindow(msg, cv2.WINDOW_NORMAL) | |
cv2.imshow(msg, im) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |