Skip to content

Instantly share code, notes, and snippets.

@Junch
Junch / cmake_list_demo.txt
Created September 5, 2022 09:23
cmake 将第三方库文件复制到项目运行时文件夹
https://www.cnblogs.com/JoyPoint/p/11629521.html
#=============Copy Source files to Build Runtime Dir===============
#该内容一般放在项目顶层CMakelists.txt的最后,
#目的是将项目生成后的执行文件所需的第三方库复制到执行程序目录,
#并区分Debug和Release版本。
#该方法中的COMMAND_EXPAND_LISTS参数值得关注,可以复制列表内所有文件。
FILE(GLOB Plugin_Runtime_Debug_DLL_FILES CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/Plugin_Runtime_Dir/Debug/*.*
)
@Junch
Junch / restart-ssh
Created September 28, 2021 07:18 — forked from influx6/restart-ssh.bash
Restart SSH on Mac Terminal (High Sierra)
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
@Junch
Junch / setting.json
Created September 8, 2021 10:08
vscode settings for LaTeX Workshop plugin
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
@Junch
Junch / SaveImageToPng.cpp
Created May 25, 2021 06:08
Windows Imaging Component Overview
#include <atlbase.h>
#include <gtest/gtest.h>
#include <wincodec.h>
#include <tchar.h>
#pragma comment(lib, "windowscodecs")
#define RETURN_IF_FAILED(hr) \
if (FAILED(hr)) \
return (hr)
@Junch
Junch / git-apply-patch.md
Created February 19, 2021 03:19 — forked from emmanueltissera/git-apply-patch.md
Generate a git patch for a specific commit

Creating the patch

git format-patch -1 <sha>
OR
git format-patch -1 HEAD

Applying the patch

git apply --stat file.patch # show stats.
git apply --check file.patch # check for error before applying

@Junch
Junch / mymath.py
Created February 4, 2021 04:04 — forked from ethanwhite/mymath.py
Simple Python nose testing example
from __future__ import division
def add(num1, num2):
assert type(num1) == int or type(num1) == float
assert type(num2) == int or type(num2) == float
return num1 + num2
def divide(numerator, denominator):
return numerator / denominator
@Junch
Junch / extension.swift
Last active August 7, 2024 07:37
swift echo server
//
// main.swift
// Echo
//
// Created by juchen3 on 1/29/21.
//
// http://www.alwaysrightinstitute.com/network-framework/
// https://www.appcoda.com.tw/network-framework-http/
import Foundation
@Junch
Junch / stack_traces.c
Created June 18, 2020 03:25 — forked from jvranish/stack_traces.c
An example of catching exceptions and printing stack traces in C on Windows, Linux and OS X
/* compile with:
on linux: gcc -g stack_traces.c
on OS X: gcc -g -fno-pie stack_traces.c
on windows: gcc -g stack_traces.c -limagehlp
*/
#include <signal.h>
#include <stdio.h>
#include <assert.h>
@Junch
Junch / matplotlib.md
Last active July 29, 2025 10:50
matplotlib汉字显示

1. 添加SimHei字体(simhei.ttf文件)

首先运行以下命令来查看matplotlib所在位置:

echo -e "import matplotlib\nprint(matplotlib.matplotlib_fname())" | python3

比如 /usr/local/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrc,将simhei.ttf拷贝到字体目录./matplotlib/mpl-data/fonts/ttf

@Junch
Junch / git-key.md
Created January 19, 2019 14:30 — forked from yisibl/git-key.md
如何创建 Git 公钥

如何创建公钥

  1. 首先启动一个Git Bash窗口(非Windows用户直接打开终端)

  2. 执行:

    cd ~/.ssh

    如果返回“… No such file or directory”,说明没有生成过SSH Key,直接进入第4步。否则进入第3步备份!