Skip to content

Instantly share code, notes, and snippets.

View xziyue's full-sized avatar

Z. "Alan" Xiang xziyue

View GitHub Profile
@xziyue
xziyue / example-bib.bib
Created March 25, 2024 03:41
Example bib file (large)
@MISC{charlotte_2020,
author = {C. Jee},
title={{An Indian politician is using deepfake technology to win new voters}},
url = {https://www.technologyreview.com/2020/02/19/868173/an-indian-politician-is-using-deepfakes-to-try-and-win-voters/}
}
@MISC{halle_2020,
author = {H. Jones},
@xziyue
xziyue / tensorflow_dense_shape_example.ipynb
Created October 3, 2022 03:12
Number of Parameters, Output Shapes of Neural Networks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xziyue
xziyue / randomized_exam.tex
Created August 23, 2022 15:07
Randomized H/V LaTeX Exam
\documentclass[answers]{exam}
\usepackage[T1]{fontenc}
\usepackage{expl3}
\usepackage{amsmath}
\usepackage{xparse}
\ExplSyntaxOn
\seq_new:N \l_curenv_seq
\seq_new:N \l_item_cmd_seq
@xziyue
xziyue / correlation_comp.py
Last active February 4, 2022 06:38
Some random correlation?
import itertools
import numpy as np
class Calculator:
def __init__(self, vars):
self.vars = vars
self.num_vars = len(vars)
self.var_index = np.arange(self.num_vars, dtype=np.uint64)
% https://tex.stackexchange.com/questions/632271/chat-like-text-bock-in-tikz-environment
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{xparse}
\usepackage{calc}
\usepackage{varwidth}
@xziyue
xziyue / seismic_wave.ipynb
Created May 8, 2021 03:54
graph seismic wave
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xziyue
xziyue / video_to_str.ipynb
Last active January 31, 2021 07:02
an example to represent videos using characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xziyue
xziyue / render_video_frame_str.py
Last active January 31, 2021 06:13
renders the string for video frames
# used in conjunction with https://gist.github.com/xziyue/0e83c7c6938d125b05d5bcad5e12e43a
import pickle
from PIL import Image, ImageFont, ImageDraw, ImageOps
import os
from multiprocessing import Pool
def generate_render_param(text_dim, font, fontsize, spacing):
test_str = '\n'.join([' ' * text_dim[1] for _ in range(text_dim[0])])
@xziyue
xziyue / chn_to_pinyin.lua
Created December 29, 2020 06:18
Chinese characters' pinyin lookup table
chn_to_pinyin = {
["吖"]="ā",["阿"]="ā",["啊"]="ā",["锕"]="ā",["錒"]="ā",["嗄"]="á",
["厑"]="ae",["哎"]="āi",["哀"]="āi",["唉"]="āi",["埃"]="āi",["挨"]="āi",
["溾"]="āi",["锿"]="āi",["鎄"]="āi",["啀"]="ái",["捱"]="ái",["皑"]="ái",
["凒"]="ái",["嵦"]="ái",["溰"]="ái",["嘊"]="ái",["敱"]="ái",["敳"]="ái",
["皚"]="ái",["癌"]="ái",["娾"]="ái",["隑"]="ái",["剴"]="ái",["騃"]="ái",
["毐"]="ǎi",["昹"]="ǎi",["矮"]="ǎi",["蔼"]="ǎi",["躷"]="ǎi",["濭"]="ǎi",
["藹"]="ǎi",["譪"]="ǎi",["霭"]="ǎi",["靄"]="ǎi",["鯦"]="ǎi",["噯"]="ài",
["艾"]="ài",["伌"]="ài",["爱"]="ài",["砹"]="ài",["硋"]="ài",["隘"]="ài",
["嗌"]="ài",["塧"]="ài",["嫒"]="ài",["愛"]="ài",["碍"]="ài",["叆"]="ài",
@xziyue
xziyue / enter_list_to_groovy.py
Created December 26, 2020 05:36
enter groovy music list into Discord
import time
from pynput.keyboard import Key, Controller
import pyperclip
import json
with open('crawl_list.json', 'r') as infile:
song_list = json.load(infile)
kb = Controller()