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 | |
a = np.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4]) | |
unique, counts = numpy.unique(a, return_counts=True) | |
print(dict(zip(unique, counts))) |
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 <opencv2/opencv.hpp> | |
using namespace cv; | |
int main() { | |
Mat img = imread("image.jpg"); | |
namedWindow("test", WINDOW_NORMAL); | |
imshow("test", img); | |
waitKey(0); | |
return 0; | |
} |
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
# https://bytebaker.com/2008/11/03/switch-case-statement-in-python/ | |
def switch_(index_): | |
def zero(): | |
print("You typed zero.\n") | |
def sqr(): | |
print("n is a perfect square\n") |
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
print("This will always be shown first\n") | |
def main(): | |
print("Calling first_module's main method\n") | |
if __name__ == '__main__': | |
# the following will be shown only in `first_module.py` | |
main() |
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
list1 = [3, 2, 4, 1, 1] | |
list2 = ['three', 'two', 'four', 'one', 'one2'] | |
zipped = zip(list1, list2) # zip two lists | |
sorted_zip = sorted(zipped) # sort | |
sorted_zip_comb = zip(*sorted_zip) # unzip, then zip again | |
print(list(sorted_zip_comb)) |
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
from random import randint | |
from bitstring import BitArray | |
# `bin()` function explained | |
bin30 = bin(30) | |
print("--> bin30:\n", bin30) | |
print("--> type(bin30):\n", type(bin30)) | |
print("--> int(bin30, 2):\n", int(bin30, 2)) | |
# generate a long list of random binary numbers |
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 mymodule | |
print(mymodule.__doc__) | |
print(mymodule.f.__doc__) |
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
from pathlib import Path | |
for img_file in Path('./JPEGImages').iterdir(): | |
with open('train.txt', 'w') as f: | |
print(img_file.resolve(), file=f) |
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
% Provide some test content | |
\begin{filecontents*}{\jobname.bib} | |
@article{Bao2015, | |
author = {Bao, Z. and Pan, G. and Zhou, W.}, | |
doi = {10.1109/TIT.2015.2421894}, | |
issue = {6}, | |
journal = IEEE_J_IT, | |
pages = {3413-3426}, | |
title = {Asymptotic Mutual Information Statistics of | |
{mimo} Channels and {CLT} of Sample Covariance Matrices}, |
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
\documentclass{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage{cite} | |
\begin{document} | |
\nocite{*} | |
\bibliographystyle{IEEEtran} | |
\bibliography{IEEEabrv,ref}{} | |
% \bibliography{IEEEabrv,references}{} |
OlderNewer