Skip to content

Instantly share code, notes, and snippets.

View Decision2016's full-sized avatar

Decision Decision2016

View GitHub Profile
@Decision2016
Decision2016 / LockOnDesktop.cs
Last active October 7, 2021 07:37
[.NET 5] Set Desktop Window
public partial class MainWindow : Window{
[DllImport("user32.dll", SetLastError = true)]
static extern UInt64 GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt64 dwNewLong);
[DllImport("user32.dll")]
static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll", SetLastError = true)]
@Decision2016
Decision2016 / singleton.py
Last active March 1, 2022 03:16
[Python] Singleton with once initialization
class Singleton(object):
_instance_lock = threading.Lock()
__instance = None
def __new__(cls, *args, **kwargs):
if cls.__instance is None:
with Singleton._instance_lock:
cls.__instance = super(
Singleton, cls).__new__(cls)
else:
@Decision2016
Decision2016 / IntelPIN.cmake
Created May 9, 2023 15:15 — forked from mrexodia/IntelPIN.cmake
IntelPIN.cmake
# Website: https://software.intel.com/content/www/us/en/develop/articles/pin-a-binary-instrumentation-tool-downloads.html
# License: https://software.intel.com/sites/landingpage/pintool/pinlicense.txt
# This snippet: https://gist.github.com/mrexodia/f61fead0108603d04b2ca0ab045e0952
# TODO: lunix support
# Thanks to Francesco for showing me this method
CPMAddPackage(
NAME IntelPIN
VERSION 3.18
URL https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.18-98332-gaebd7b1e6-msvc-windows.zip
@Decision2016
Decision2016 / bitcoin-simple-transaction.go
Created April 8, 2024 07:36
Simple Bitcoin Transaction
package main
import (
"bytes"
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2/schnorr"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
@Decision2016
Decision2016 / outdate.js
Created April 11, 2024 05:49
Hexo outdate mention
// Copy from https://qianfanguojin.top/2022/09/07/Hexo%E5%8D%9A%E5%AE%A2%E8%BF%9B%E9%98%B6%EF%BC%9A%E4%B8%BA-Next-%E4%B8%BB%E9%A2%98%E7%9A%84-Hexo-%E5%8D%9A%E5%AE%A2%E5%86%85%E5%AE%B9%E6%B7%BB%E5%8A%A0%E6%96%87%E7%AB%A0%E8%BF%87%E6%9C%9F-%E6%97%B6%E6%95%88%E6%8F%90%E7%A4%BA/
// injector.js
// 注入文章过期提示
// hexo.extend.injector.register('body_end', `<script src="/js/outdate.js"></script>`,'post')
(function() {
//不同的日期显示不同的样式,200 天为黄色提示,400天为红色提示,可以自己定义。
let warningDay = 200;
@Decision2016
Decision2016 / config.yml
Last active June 9, 2024 13:44
golang plugin example
plugin:
name: "test"