Skip to content

Instantly share code, notes, and snippets.

View SeanSyue's full-sized avatar
🏔️
Nature Lover

Yuchen Xue SeanSyue

🏔️
Nature Lover
View GitHub Profile
@SeanSyue
SeanSyue / download_megaface.sh
Last active November 24, 2020 02:37
Download all files from [Megaface Challenge](http://megaface.cs.washington.edu/)
#! /bin/bash
# Specify the destination of donwloaded files
DESTINATION="megaface_downloads"
# You may get the credential by following the instructions in
# `http://megaface.cs.washington.edu/participate/challenge.html`
# Follow the below format for the credential file:
# ```
# machine megaface.cs.washington.edu
# login <your-login-name>
@SeanSyue
SeanSyue / algo-test.tex
Created March 13, 2019 07:10
Simple algorithm test in latex
\documentclass{article}
\usepackage[utf8]{inputenc}
% \usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{algorithm, algorithmic}
% \usepackage{algorithm,algpseudocode}
% \usepackage{amsfonts}
% ---------- BEGIN of managing indent in algorithm ----------
\newlength\myindent
\setlength\myindent{2em}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{cite}
\begin{document}
\nocite{*}
\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,ref}{}
% \bibliography{IEEEabrv,references}{}
@SeanSyue
SeanSyue / filecontents-sample.tex
Created March 13, 2019 07:08
file­con­tents and file­con­tents* en­vi­ron­ments en­able a LATEX source file to gen­er­ate ex­ter­nal files as it runs through LATEX. <https://ctan.org/pkg/filecontents?lang=en>
% 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},
@SeanSyue
SeanSyue / chrome_drive_download.py
Created August 24, 2018 04:10
[TEST] Download images from "meitulu" using `selenium`
import urllib.request
import requests
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
import time
@SeanSyue
SeanSyue / yolo_gen_train_lst.py
Created August 14, 2018 02:56
Generate training list for darknet yolo training.
from pathlib import Path
for img_file in Path('./JPEGImages').iterdir():
with open('train.txt', 'w') as f:
print(img_file.resolve(), file=f)
@SeanSyue
SeanSyue / import_doc.py
Created August 12, 2018 07:59
A simple example on importing docstring in Python.
import mymodule
print(mymodule.__doc__)
print(mymodule.f.__doc__)
@SeanSyue
SeanSyue / gen_bin_num.py
Created August 12, 2018 07:50
Example on how to generate binary numbers in Python.
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
@SeanSyue
SeanSyue / zip_sorted.py
Created August 12, 2018 07:42
Combine `zip()` and `sorted()` to get a new long sorted list.
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))
@SeanSyue
SeanSyue / first_module.py
Created August 12, 2018 03:05
Example on understanding "__name__ == '__main__'" in Python.
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()