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 | |
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 |
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
def read_and_decode(filename_queue): | |
"""Read from tfrecords file and decode and normalize the image data.""" | |
reader = tf.TFRecordReader() | |
_, serialized_exmaple = reader.read(filename_queue) | |
features = tf.parse_single_example( | |
serialized_exmaple, | |
features={ | |
'image': tf.FixedLenFeature([], tf.string), | |
'label': tf.FixedLenFeature([], tf.int64), |
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 sys | |
import pkgutil | |
import importlib | |
from .base import BaseCommand, CommandExecutor | |
def discover_commands(): | |
executor = CommandExecutor() | |
current_module = sys.modules[__name__] | |
__path__ = pkgutil.extend_path(current_module.__path__, __name__) |
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
/** | |
* 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 |
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
# losslessly concat mp4 files | |
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts | |
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts | |
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4 | |
# concat files with the same format | |
# 1. create a file list | |
file '/path/to/file1' | |
file '/path/to/file2' | |
file '/path/to/file3' |
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
// Remove null or undefine from array items | |
type NonNullableArray<T> = T extends Array<infer Item> ? Array<NonNullable<Item>> : never; |
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
#!/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 |
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
patch: | |
schema_list: | |
- schema: luna_pinyin_simp | |
- schema: emoji |
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
type TestType = { | |
key: string; | |
value: string; | |
} | |
export TestType; |
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
! 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 |
NewerOlder