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 os | |
import glob | |
import moviepy.editor as mpe | |
IMAGE_ROOT = '/Users/huangzhengyue/work_data/jiaolou3' | |
OUT_FILE_NAME = 'test3.mp4' | |
FPS = 12 | |
def main(): |
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 os | |
import sys | |
import glob | |
import tqdm | |
import json | |
import shutil | |
import pickle | |
import argparse | |
import numpy as np | |
from PIL import Image |
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
# | |
# Taken from https://www.gadgetdaily.xyz/create-a-cool-sliding-and-scrollable-mobile-menu/ | |
# | |
# Convert value returned from Linux event device ("evdev") to a HID code. This | |
# is reverse of what's actually hardcoded in the kernel. | |
# | |
# Lubomir Rintel <[email protected]> | |
# License: GPL | |
# | |
# Ported to a Python module by Liam Fraser. |
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 socket | |
import selectors | |
in_stream_selector = selectors.DefaultSelector() | |
out_stream_selector = selectors.DefaultSelector() | |
write_handlers = {} | |
class WriteHandler: |
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 cv2 | |
import os | |
import sys | |
import numpy as np | |
def tight_cut(path): | |
path = os.path.abspath(path) | |
file_name = os.path.basename(path) | |
dir_name = os.path.dirname(path) |
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
void mergeSort(int *arr, int *out, int start, int end) { | |
if (end == start + 1) { | |
out[0] = arr[start]; | |
return; | |
} | |
int mid = (start + end) / 2; | |
int left_length = mid - start; | |
int right_length = end - mid; | |
int *left = new int[left_length]; | |
int *right = new int[right_length]; |
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 requests | |
import argparse | |
import hashlib | |
def login(username, password): | |
password = '{MD5_HEX}' + hashlib.md5(password.encode('utf-8')).hexdigest() | |
r = requests.post('http://net.tsinghua.edu.cn/do_login.php', | |
data={'action': 'login', 'username': username, 'password': password, 'ac_id': 1}) | |
print(r.text) |
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 merge_sort(array): | |
if len(array) == 1: | |
return [array[0]] | |
elif len(array) == 2: | |
if array[0] > array[1]: | |
return [array[1], array[0]] | |
return [array[0], array[1]] | |
mid = len(array) // 2 | |
left = merge_sort(array[0:mid]) | |
right = merge_sort(array[mid:]) |
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 shell_sort(array): | |
gap = len(array) // 2 | |
while gap > 0: | |
for i in range(gap, len(array)): | |
for j in range(i - gap, -1, -1): | |
if array[j] <= array[j + gap]: | |
break | |
tmp = array[j] | |
array[j] = array[j + gap] | |
array[j + gap] = tmp |
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 quick_sort(array): | |
def partition(array, start, end): | |
i = start - 1 # i represent the last index of smaller set | |
pivot = end - 1 | |
# j represent the working pointer | |
for j in range(start, end - 1): | |
# swap | |
if array[j] < array[pivot]: | |
i += 1 | |
tmp = array[j] |
NewerOlder