Skip to content

Instantly share code, notes, and snippets.

@Miragecore
Miragecore / mkvScreenshot.bat
Last active November 16, 2018 01:26
Take a screenshot with subtitles of every mkv file in the directory, at 10 seconds after the video starts
rem Take a screenshot with subtitles of every mkv file in the directory,
rem at 10 seconds after the video starts
@echo off
SET count=1
FOR /f "tokens=*" %%G IN ('dir /b') DO (call :subroutine "%%G")
GOTO :eof
:subroutine
set tmp=%1
@Miragecore
Miragecore / OpenFileDialog c# wpf
Last active February 24, 2020 23:11
OpenFileDialog c#
using System;
using System.IO;
using System.Windows;
using Microsoft.Win32;
namespace WpfTutorialSamples.Dialogs
{
public partial class OpenFileDialogSample : Window
{
public OpenFileDialogSample()
@Miragecore
Miragecore / singleton.cs
Created March 13, 2020 04:20
singleton pattern
//from https://csharpindepth.com/articles/singleton
public sealed class Singleton
{
private static readonly Singleton instance = new Singleton();
// Explicit static constructor to tell C# compiler
// not to mark type as beforefieldinit
static Singleton()
{
}
//https://stackoverflow.com/questions/18490123/destructor-never-gets-called
public class Class : IDisposable
{
private Task task;
private CancellationTokenSource cts = new CancellationTokenSource();
AutoResetEvent arEvtProcRun = new AutoResetEvent(false);
Class()
{
task = new Task(Run, cts.Token, TaskCreationOptions.LongRunning);
@Miragecore
Miragecore / gist:b69f20934ec20983e4d0ec956a56980d
Created February 6, 2022 05:24
Colab Python version change
if True:
ver = !python -V
print(ver[0])
if ver[0] != 'Python 3.8.9':
!wget https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz
!tar xvfz Python-3.8.9.tgz
%cd Python-3.8.9
!./configure
!make
!sudo make install