Skip to content

Instantly share code, notes, and snippets.

View RuolinZheng08's full-sized avatar

Lynn Zheng RuolinZheng08

View GitHub Profile
@RuolinZheng08
RuolinZheng08 / blink.rpy
Created July 30, 2018 16:04
[RENPY] Dynamic Blink
@RuolinZheng08
RuolinZheng08 / pixelcolor.py
Last active September 25, 2018 04:10
[Python] Image processing & filter
#!/usr/bin/python3
from PIL import Image
# Replace pixels of an input color in the image with a new color
fname = input('Enter image name: ')
oldc = input('Enter color (R, G, B) to be replaced: ')
newc = input('Enter color (R, G, B) for replacement: ')
if len(fname) < 1: fname = 'identicon.png'
if len(oldc) < 1:
@RuolinZheng08
RuolinZheng08 / scrapwechat.py
Last active September 25, 2018 13:14
[Python] Scrap thumbnails from WeChat Official Account Posts
#!/usr/bin/python3
from urllib.request import urlopen
import ssl
import re, os, sys
# ignore ssl certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
@RuolinZheng08
RuolinZheng08 / index.html
Last active January 31, 2021 20:48
[Template] DataTable in HTML/JavaScript With JSON Data
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>2019 Grace Hopper Company Look-Up</title>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css'>
</head>
<body>
@RuolinZheng08
RuolinZheng08 / projector-config.json
Last active January 31, 2021 20:48
[Config, CSV] TensorBoard config for [Acoustic Word Embeddings project](https://github.com/RuolinZheng08/phonetic-acoustic-word-embeddings)
{
"embeddings": [
{
"tensorName": "Acoustic Word Embeddings",
"tensorShape": [
200, 1024
],
"tensorPath": "https://gist.githubusercontent.com/RuolinZheng08/ce93900f4876b63f598becfdc696f190/raw/40af822d8db5ebe6ae2aa056cbfd7153b3d19ede/test-embs-vecs.tsv",
"metadataPath": "https://gist.githubusercontent.com/RuolinZheng08/ce93900f4876b63f598becfdc696f190/raw/40af822d8db5ebe6ae2aa056cbfd7153b3d19ede/test-embs-meta.tsv"
}
@RuolinZheng08
RuolinZheng08 / mfcc.py
Last active January 31, 2021 20:47
[Python] Mel-frequency Cepstrum
from IPython.display import Audio
import numpy as np
from numpy.fft import fft, ifft
from scipy.fftpack import dct, idct
from scipy.signal import stft
import soundfile as sf
@RuolinZheng08
RuolinZheng08 / index.html
Last active January 31, 2021 20:47
[Template] Dummy index.html for GitHub repo page
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Just a dummy html to redirect to my subdirectory -->
<meta http-equiv="refresh" content="0; url=[INSERT URL HERE]">
</head>
<body>
</body>
@RuolinZheng08
RuolinZheng08 / HtmlToPdf.java
Last active February 8, 2023 04:50
[Java] HTML (to XHTML) then to PDF with CSS 2.1 Support | Flying Saucer + OpenPDF
import java.io.*;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.xhtmlrenderer.extend.FontResolver;
import org.xhtmlrenderer.pdf.ITextRenderer;
public class HtmlToPdf {
public static void main(String[] args) throws IOException {
String html = "<h1>hello</h1>";
String xhtml = htmlToXhtml(html);
@RuolinZheng08
RuolinZheng08 / sudoku_solver.py
Created August 9, 2020 21:43
[Python] Sudoku Solver | CodePath Dynamic Programming & Backtracking Project
from itertools import product
class SudokuSolver:
"""
Solve a sudoku puzzle given as a 81-digit string with . denoting empty
"""
SHAPE = 9
GRID = 3
EMPTY = '.'
@RuolinZheng08
RuolinZheng08 / CreatorDefinedDisplayable.rpy
Last active July 1, 2022 13:54
[Ren'Py, Template] Creator-Defined Displayable
class CreatorDefinedDisplayable(renpy.Displayable):
def __init__(self):
super(CreatorDefinedDisplayable, self).__init__()
def render(self, width, height, st, at):
render = renpy.Render(width, height)
return render
def event(self, ev, x, y, st):