Skip to content

Instantly share code, notes, and snippets.

View 1f0's full-sized avatar
🎯
focusing

Minliang LIN 1f0

🎯
focusing
View GitHub Profile
@1f0
1f0 / test-ffmpeg-filter.py
Created July 19, 2019 06:08
example of testing different filter of ffmpeg
import ffmpeg
(
ffmpeg
.input('D:\\P\\ffmpeg-20190702-231d0c8-win64-static\\bin\\xiaoice_360p.mp4', re=None)
.audio
.filter('aderivative')
.output('rtmp://localhost/live/test', f='flv')
.run()
)
import argparse
# config parser
parser = argparse.ArgumentParser()
parser.add_argument("mesh")
parser.add_argument("-f", "--framefield", default="")
parser.add_argument("-n", "--quadnum", type=int, default=500)
<ServerManagerConfiguration>
<ProxyGroup name="filters">
<!-- ================================================================== -->
<SourceProxy name="DistancePolyDataFilter" class="vtkDistancePolyDataFilter" label="DistancePolyDataFilter">
<Documentation
long_help="Computes the signed distance from one vtkPolyData to another."
short_help="vtkDistancePolyDataFilter.">
</Documentation>
<InputProperty
%% copy from ocw.mit.edu
%% random matrix theory
%n=20; s=30000; d=.05; %matrix size, samples, sample dist
n=10; s=1000; d=.05; % s=30000 is too slow
e=[]; %gather up eigenvalues
im=1; %imaginary(1) or real(0)
for i=1:s,
a=randn(n)+im*sqrt(-1)*randn(n);a=(a+a')/(2*sqrt(2*n*(im+1)));
@1f0
1f0 / so2-opt.m
Created March 7, 2019 01:53
optimization of quadratic form of [SO_2]^n
%% f2d.m
function f2d(A)
x=0:0.05:3*pi;
[X, Y]=meshgrid(x);
F=zeros(size(X));
min_val = inf;
min_coord = [0 0];
max_val = -inf;
max_coord = [0 0];
@1f0
1f0 / read-and-sum.cpp
Last active February 20, 2019 13:45
basic c++ read file
#include <iostream>
#include <exception>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char const *argv[]) {
if (argc < 2) {
cout << "Usage: " << argv[0] << " filename.txt" << endl;
return 0;
@1f0
1f0 / clock.py
Created February 10, 2019 14:29
A simple clock under windows os, using python library 'keyboard' to detect hot-key.
import keyboard
import time
from tkinter import *
class Clock(Tk):
def __init__(self, master=None):
Tk.__init__(self, master)
self.wm_attributes("-topmost", 1)
self.createWidgets()
find . -name "*.zip" | while read filename; do unzip -o -d "`dirname "$filename"`" "$filename"; done;
@1f0
1f0 / rm-not-match.sh
Created December 31, 2018 03:47
rm not match files
sed -e 's,^,^,' -e 's,$,$,' filelist > newfilelist
cd your_directory
ls | egrep -vf newfilelist | xargs -n 1 echo rm > rmscript
#If the files have spaces in their name (if the files have the " in the name that will not works) :
ls | egrep -vf newfilelist | sed 's,^\(.*\)$,rm "\1",' > rmscript
//!Makefile, replace $USER with your name
//INC=-I/home/$USER/libs/libigl/include -I/home/$USER/libs/eigen3
//all:
// g++ -std=c++11 $(INC) voxel.cpp -o voxel.out
#include <igl/bounding_box.h>
#include <igl/readOBJ.h>
#include <igl/writeOFF.h>
#include <string>
#include <vector>