Skip to content

Instantly share code, notes, and snippets.

@yxw
yxw / mysql-init-demo.yaml
Created August 16, 2023 08:49 — forked from hossainemruz/mysql-init-demo.yaml
Sample MySQL deployment to initialize from *.sql file
# Here, I am using a gcePersistentDisk disk to store my init.sql file.
# You can you any Kubernetes volume such as hostPath,nfs etc.
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-init-demo
spec:
selector:
matchLabels:
app: mysql
@yxw
yxw / EmbeddedDllClass.cs
Created August 2, 2019 08:49
embed unmanged dll into a managed C# dll
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.IO;
using System.Reflection;
using System.ComponentModel;
namespace yxw
{
///Refer to:
@yxw
yxw / UAC_Win7.xml
Last active July 11, 2019 02:54
Fix UAC Compatibility in Windows Vista and Windows 7
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
@yxw
yxw / gist_stop_resume_tracking_binaries.txt
Last active July 5, 2019 07:48
git temporarily stop / resume tracking files (usually binaries)
# stop tracking binaries
git ls-files -z /path/to/bin/ | xargs -0 git update-index --assume-unchanged
# resume tracking binaries
git update-index --no-assume-unchanged /path/to/bin/*.*
@yxw
yxw / git-pull-all.sh
Created April 15, 2019 02:19
Pull all branches from remote
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
// App.xaml.cs
public void SwitchToLanguageCN()
{
ChangeLanguage("zh-CN");
}
// MainWindow.xaml.cs
private void btn_switchtogcn_Click(object sender, RoutedEventArgs e)
{
((App)Application.Current).SwitchToLanguageCN();
@yxw
yxw / cpp11_bind_service.cpp
Last active April 15, 2019 02:21
C++11 - bind server and services
#include <string>
#include <iostream>
#include <functional>
class Service
{
public:
void listen( std::function< void ( const std::string&,
const std::string&,
const std::string&,