Skip to content

Instantly share code, notes, and snippets.

@hkusoft
hkusoft / PyIsbnFileRename-main.py
Last active March 5, 2023 13:28
Use this script to scan all files in an input folder : Any file that has the ISBN format name, e.g. 9781803239736.epub etc. will be renamed to the real file name, e.g. ·Microsoft Excel.epub·
# Use this function scans all files in an input folder
# Any file that has the ISBN format name, e.g. 9781803239736.epub etc.
# will be renamed to the real file name, e.g. ·Microsoft Excel.epub·
# Install dependencies with virtualdev
# ```
# pip install virtualenv
# virtualenv winenv # winenv is any name your like to create
# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass # important, winOS only
# pip install -r .\requirements.txt # install dependencies
@hkusoft
hkusoft / ResizeVideo.py
Created October 10, 2021 07:12
Batch resize mp4 files down to 100M or below using FFmpeg
import glob
import os
import sys
def get_all_mp4s(folder):
pattern = folder + '/**/*.mp4'
files = glob.glob(pattern, recursive=True)
return files
def convert(files):
@hkusoft
hkusoft / OsgSnapshotHelper.cpp
Created March 23, 2021 00:50
OsgSnapshotHelper by David Kou
#include "stdafx.h"
#include "OsgSnapshotHelper.h"
OsgSnapshotHelper::OsgSnapshotHelper(osgViewer::Viewer* pView)
{
pViewer = pView;
// Install custom renderer
osg::ref_ptr<CustomRenderer> customRenderer = new CustomRenderer(pViewer->getCamera());
@hkusoft
hkusoft / rebase.md
Created December 7, 2020 06:36
rebase-ineractive

#git rebase -i <sha>

List of commits from git log

F--E--D--C--B--A  ➟  F--E--C--B--A
     ✂

Lets say you want to remove commit D from the commits.

@hkusoft
hkusoft / rebase.md
Last active December 7, 2020 06:32 — forked from todgru/rebase.md
git rebase interactive remove commit

#git rebase -i <sha>

List of commits from git log

F--E--D--C--B--A  ➟  F--E--C--B--A
     ✂

Lets say you want to remove commit D from the commits.

@hkusoft
hkusoft / GitAlias.csv
Last active July 6, 2021 10:03
Git Alais for JustType App
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 6.
ShortCode,FullStringCode
gb , git branch\n
gc , git checkout
gl , git log --oneline\n
gd , git diff
gm , git commit -m ""
gs , git status\n
gaa , git add .\n
gam , git commit -am ""
@hkusoft
hkusoft / FiresharpEventHandling.cs
Created April 9, 2020 06:46
How to subscribe Firebase realtime DB event
//client1 = new FireSharp.FirebaseClient(new FirebaseConfig(...));
client1.OnAsync(StringPath, Added, Changed, Removed);
private void Removed(object sender, ValueRemovedEventArgs args, object context)
{
Log(args.Path + " removed");
}
private void Changed(object sender, ValueChangedEventArgs args, object context)
{
var workbook = new Excel.Workbook();
workbook.xlsx.readFile(filename).then(() => {
var worksheet = workbook.getWorksheet(sheet);
worksheet.eachRow({ includeEmpty: true }, function(row, rowNumber) {
console.log("Row " + rowNumber + " = " + JSON.stringify(row.values));
});
});
@hkusoft
hkusoft / Intellectual Property & Innovation
Last active February 14, 2019 08:28
Intellectual Property & Innovation
A ppt
@hkusoft
hkusoft / CameraFacing.cs
Last active March 29, 2018 07:27
Make 3D text always camera facing
using UnityEngine;
using System.Collections;
/// <summary>
/// Place this script on a GameObject that you want to face the camera.
/// Then, with the object selected, use the inspector to select the
/// Camera you want the object to face.
///
/// Update: If you don't specify the camera, Camera.Main will be used instead
///