Skip to content

Instantly share code, notes, and snippets.

@syaifulnizamyahya
syaifulnizamyahya / gist:ad99fac77eddf0bd0164160388f731d9
Created July 22, 2024 07:48
WPF MVVM Toolkit add new button with command
in xaml
<Button Content="Generate key" Command="{Binding GenerateKeyCommand}"/>
in viewmodel
private RelayCommand generateKeyCommand;
public ICommand GenerateKeyCommand => generateKeyCommand ??= new RelayCommand(GenerateKey);
private void GenerateKey()
{
MessageBox.Show("GenerateKey");
@syaifulnizamyahya
syaifulnizamyahya / gist:30788aca67a3dc1c74a7925e48801c44
Last active July 22, 2024 07:46
WPF MVVM Toolkit add new button with async command
in xaml
<Button Content="Generate key" Command="{Binding GenerateKeyCommand}"/>
in viewmodel
private IAsyncRelayCommand generateKeyCommand;
public IAsyncRelayCommand GenerateKeyCommand => generateKeyCommand ??= new AsyncRelayCommand(GenerateKey);
private Task GenerateKey()
{
MessageBox.Show("GenerateKey");
@syaifulnizamyahya
syaifulnizamyahya / cpp14Concurrency.cpp
Created June 19, 2024 10:08
Example showing how to use concurrency in C++ 14. (single thread, multi thread, asynchronous)
// Shared data structure
std::vector<int> shared_vector;
std::mutex mtx;
// Function for adding elements to the vector
void add_elements(int thread_id)
{
for (int i = 0; i < 5; ++i)
{
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // Simulate work
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--created on 2021-09-07 18:58:16 - tinyMediaManager 3.1.16.1-->
<movie>
<title>Mary Poppins</title>
<originaltitle>Mary Poppins</originaltitle>
<sorttitle/>
<epbookmark/>
<year>1964</year>
<ratings>
<rating default="false" max="10" name="themoviedb">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--created on 2021-09-07 18:58:17 - tinyMediaManager 3.1.16.1-->
<movie>
<title>Mary Poppins Returns</title>
<originaltitle>Mary Poppins Returns</originaltitle>
<sorttitle/>
<epbookmark/>
<year>2018</year>
<ratings>
<rating default="false" max="10" name="themoviedb">
@syaifulnizamyahya
syaifulnizamyahya / README.md
Last active July 28, 2019 11:28 — forked from bburky/README.md
Get Steam Cover Images Playnite Extension

Get Steam Cover Images Playnite Extension

This is a fork of extension created by Blake Burkhart. Updated for Playnite 5.0.

Replaces the cover image of the selected games with the Steam header image for the game. If the game is not a Steam game, the game's links will be parsed for a Steam store link to guess the game's AppID.

Setting game's covers to an internet URL may be slow to load, so enabling "Asynchronous image loading" in Playnite's settings is suggested.

To install, extract the downloaded extension to \Playnite-install-path\Extensions\ folder. Start Playnite >> click playnite icon >> Extension >> Reload Scripts. You should see "Get Steam Header Images for Selected Games" option under Extension. If not, restart Playnite and you should see it under Extension. Select all the games that you want to update with steam banner, then click the "Get Steam Header Images for Selected Games" extension. After a while(of not responding Playnite), t

Install rclone
Install encfs
Rclone config
Create target directory
Mount rclone
Mount encfs
Smb uses diff password. Setup it like below
sudo smbpasswd -a <username>
@syaifulnizamyahya
syaifulnizamyahya / GetAspectRatio.cpp
Last active August 9, 2022 14:54
Finding correct aspect ratio of flat paper captured from camera
// Get3dRectFrom2d.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/aruco.hpp>
#define CAMERA_WINDOW "Simple ArUco"
@syaifulnizamyahya
syaifulnizamyahya / advancedsettings.xml
Created October 20, 2018 16:34
Kodi advanced settings
<advancedsettings>
<video>
<excludefromscan>
<regexp>(noscan)</regexp>
<regexp>[Rr][Ee][Mm][Uu][Xx]</regexp>
<regexp>[!-._ \\/][Tt][Rr][Aa][Ii][Ll][Ee][Rr][!-._ \\/]</regexp>
<regexp>[!-._ \\/][Ss][Aa][Mm][Pp][Ll][Ee][!-._ \\/]</regexp>
</excludefromscan>
<excludetvshowsfromscan>
<regexp>(noscan)</regexp>
@syaifulnizamyahya
syaifulnizamyahya / autostart.sh
Last active October 20, 2018 15:51
Autorun script to mount rclone and encfs for libreelec
#/bin/sh
cd /storage/downloads/Tool/RcloneTool/tmp
curl -O https://downloads.rclone.org/rclone-current-linux-arm64.zip
unzip -o rclone-current-linux-arm64.zip
cd rclone-*-linux-arm64
cp * /storage/downloads/Tool/RcloneTool/bin
chown root:root /storage/downloads/Tool/RcloneTool/bin/rclone
chmod 755 /storage/downloads/Tool/RcloneTool/bin/rclone
cd /storage/downloads/Tool/RcloneTool/bin