Skip to content

Instantly share code, notes, and snippets.

View sunjerry019's full-sized avatar

Sun Yudong sunjerry019

View GitHub Profile
@sunjerry019
sunjerry019 / getunique.sh
Created July 25, 2023 16:43
Get Unique files based on hash
#!/bin/bash
sha1sum * | awk '!x[$1]++'
@sunjerry019
sunjerry019 / plotter.py
Last active July 14, 2023 21:31
Plotter
#!/usr/bin/env python3
# PLOTTER CLASS
from matplotlib import rc
import matplotlib.pyplot as plt
import matplotlib.patches as mpl_p
import matplotlib.legend as mpl_l
@sunjerry019
sunjerry019 / clock.html
Created January 25, 2022 19:52
Basic Analog Clock with Cursor Hide
<!DOCTYPE HTML>
<html>
<!-- https://codepen.io/kylewetton/pen/QJbOjw -->
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<title>Clock</title>
<style type="text/css">
html,
body {
@sunjerry019
sunjerry019 / gnome-shell.css
Created January 5, 2022 19:46
Changing the font-weight and color of gnome top bar
/* Add to the bottom */
/* Background of the top bar */
#panelBox {
background: #000;
}
/* font/icon color and weight */
#panel StIcon {
color: #aaa;
@sunjerry019
sunjerry019 / README.md
Last active November 9, 2022 09:08
Using an (GUI) ActiveX Control in Python

Using an (GUI) ActiveX Control in Python (Minimal Example)

I was trying to use a GUI-only ActiveX Control in Python (using an OCX File) and I managed to get it working using PyQt5 as an intermediary.

See the below minimal example code using the ActiveX Control DATARAOCX.GetDataCtrl.1.

I found this way more elegant than using comtypes, wxpython or similar, especially since comtypes kept throwing a "Catastropic Error" whenever I try to access the ActiveX Control.

Hope this helps someone also stuck in this problem.

@sunjerry019
sunjerry019 / README.md
Last active January 19, 2021 09:14
ffmpeg options with QSV

To crop a video with QSV hardware acceleration:

ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -i 'input.mp4' -vf crop=width:height,hwupload=extra_hw_frames=64,format=qsv -movflags +faststart -c:v hevc_qsv -load_plugin hevc_hw -global_quality 25 -max_muxing_queue_size 1024 -c:a copy 'test.mp4'
@sunjerry019
sunjerry019 / findandcompress.sh
Last active January 18, 2022 16:55
Hardware accelerated ffmpeg compression using NVENC/QuickSync to decode and encode
#!/bin/bash
# usage: findandcompress.sh [ nvconstqp | nvvbr | fullqsv | qsv | vaapi | software ]
# default software
# https://stackoverflow.com/a/14203146/3211506
if [[ $# -gt 1 ]]; then
echo "Max 1 argument allowed"
exit 1
fi
@sunjerry019
sunjerry019 / askmap-highlights.tex
Last active May 30, 2020 16:51
LaTeX Package askmap with tikz style rounded boxes using picture commands
% Was trying to find an American Style Karnaugh Map drawing package that supported coloured
% boxes but it was pretty hard to find, and example code was hard to come by.
% Hence, this is a MWE gist for a K-Map with 2 variables and boxes
% You need to compile this 2 times for it show correctly
\documentclass[varwidth]{standalone}
\usepackage[dvipsnames]{xcolor} % For colours
\usepackage{geometry} % For proper standalone output