Skip to content

Instantly share code, notes, and snippets.

View charlee's full-sized avatar

Charlee Li charlee

View GitHub Profile
import numpy as np
from scipy.signal import get_window
from scipy.fftpack import fft, fftshift
import math
import matplotlib.pyplot as plt
eps = np.finfo(float).eps
"""
A4-Part-1: Extracting the main lobe of the spectrum of a window
@charlee
charlee / DrawOnGithubContribCalendar.js
Last active June 30, 2022 19:26
DrawOnGithubContribCalendar
/**
* Draw string in the github contribution calendar.
* Usage:
* 1. Create a "snippet" in the Chrome devtool -> Sources -> Snippets (in left sidebar).
* 2. Visit your github profile page.
* 3. Modify the string.
* 4. Run
*
* Credit:
* - 3x5 font data: https://github.com/fabiopiratininga/oled-font-3x5
@charlee
charlee / types.ts
Created January 13, 2022 15:27
TypeScript Utility types
// Remove null or undefine from array items
type NonNullableArray<T> = T extends Array<infer Item> ? Array<NonNullable<Item>> : never;
@charlee
charlee / test1.tsx
Last active May 22, 2019 15:20
medium test
type TestType = {
key: string;
value: string;
}
export TestType;
@charlee
charlee / .Xmodmap
Last active February 9, 2019 22:38 — forked from timofurrer/.Xmodmap
Mint Linux on MacBook.
! Swap Alt and Cmd keys.
keycode 37 = Control_L
keycode 133 = Alt_L Meta_L
keycode 64 = Super_L
keycode 108 = Super_R
keycode 134 = ISO_Level3_Shift Multi_key
keycode 105 = Control_R Multi_key
clear Shift
clear Lock
clear Control
@charlee
charlee / README.md
Created September 8, 2018 13:43 — forked from int128/README.md
Watching build mode on Create React App

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.

How to Use

Create a React app.

Put the script into scripts/watch.js.

@charlee
charlee / Dockerfile
Created September 4, 2018 03:10
Docker file from alpine:3.8 to solve the x509 issue
FROM alpine:3.8
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
@charlee
charlee / reddit-scraper.py
Last active June 11, 2021 02:15
A script that scrape top news from Reddit and extract the content as Markdown.
#!/usr/bin/env python
import os
import re
import praw
import requests
from datetime import datetime
from bs4 import BeautifulSoup
for sub in subs:
res = requests.get(sub.url)
if (res.status_code == 200 and 'content-type' in res.headers and
@charlee
charlee / sequence.csv
Created May 7, 2018 13:24
R for Pythoners
R Python Note
seq(1,5) == 1,2,3,4,5 range(1,5) == [1,2,3,4] The 'stop' number is included in R while excluded in Python
seq(5,1) range(5,1,-1) The sign of 'step' is automatically determined in R while must be specified explicitly in Python
@charlee
charlee / Game-1.css
Last active May 4, 2018 01:02
Conway's Game of Life
.Board {
position: relative;
margin: 0 auto;
background-color: #000;
}