Skip to content

Instantly share code, notes, and snippets.

View chaojian-zhang's full-sized avatar
🏯
When I am doing programming: I want to be God.

Charles Zhang chaojian-zhang

🏯
When I am doing programming: I want to be God.
View GitHub Profile
@chaojian-zhang
chaojian-zhang / RegRename
Created March 21, 2021 21:10
A CLI (Command Line Interface) utility to rename files with regular expression (C# style). Itch.IO: https://charles-zhang.itch.io/rename
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace RegRename
{
class Program
{
static void Main(string[] args)
@chaojian-zhang
chaojian-zhang / PythonVideoCaptureJPGs.py
Last active June 26, 2022 03:26
Video Capture (Python,Cv2)
# This is VERY INEFFICIENT - at the moment for 10min video it produces 10*60*25=15000 images
# The framerate calculation is WRONG: it's NOT taking screenshots every 10 frames, but it's taking every frame!
# In fact, it's faster and more efficient if we just re-watch the video in VLC and use Alt-V-S shortcut to take screenshots when needed
import cv2
vidcap = cv2.VideoCapture('temp.mp4')
framerate = vidcap.get(cv2.CAP_PROP_FPS)
success,image = vidcap.read()
count = 0
@chaojian-zhang
chaojian-zhang / pandoc.md2pdf.sublime-build
Created January 9, 2020 21:15 — forked from keuv-grvl/pandoc.md2pdf.sublime-build
Convert Markdown to PDF within Sublime Text using Pandoc
{
"cmd": ["pandoc --pdf-engine=xelatex --filter=pandoc-citeproc -o '$file_base_name.pdf' '$file_name'"],
"selector": "text.html.markdown",
"shell": true
}
@chaojian-zhang
chaojian-zhang / CSharpServer.cs
Last active January 16, 2020 03:54
A C# server that reads local files as input and output new total numbers based on input.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CSharpServer
{