Skip to content

Instantly share code, notes, and snippets.

View mightbxg's full-sized avatar

Xinguang Bian mightbxg

  • Nanjing, Jiangsu, China
View GitHub Profile

Image Viewer

  • feh
  • nomacs
@mightbxg
mightbxg / modify_figure.m
Created December 22, 2022 06:05
modify figures in matlab
%% get axes handles
ax_hdls = findobj(groot, 'type', 'axes');
ax_1 = ax_hdls(1);
ax_2 = ax_hdls(2);
% set Y limits
set([ax_1, ax_2], 'YLim', pitch_range);
% plot
plot(ax_1, x, y);
@mightbxg
mightbxg / gist:0322089efee8d410e8d231a9d5850f57
Created November 3, 2022 02:15
Search Engine for Chrome
Keyword: cppreference.com
Link: https://en.cppreference.com/mwiki/index.php?title=Special:Search&search=%s
@mightbxg
mightbxg / xx-tmux.sh
Created July 13, 2022 11:52
auto tmux session example
#!/usr/bin/env bash
session='xx'
# check session exists
tmux has-session -t $session 2>/dev/null
if [ $? -eq 0 ]; then
read -p "tmux session [$session] already exists, kill it and reopen one? [Y/n]" -n 1 -r
echo
if [[ $REPLY =~ ^[Nn]$ ]]; then
echo "abort."
@mightbxg
mightbxg / font_installation_guide.md
Created May 25, 2022 03:11
How to install fonts on linux

Reference

Download fonts:

  1. nerd-fonts
  2. Sarasa-Gothic (中文)

Installation:

  1. Run mkdir -p ~/.local/share/fonts
  2. Move font files or folders to ~/.local/share/fonts
  3. Reboot or run fc-cache -fv
@mightbxg
mightbxg / object_pool.h
Last active April 16, 2022 04:04
Object pool in c++
///@brief Object pool that manages objects with std::shared_ptr.
///@note The object will be reused only when it's released outside the pool.
template <typename T>
class SharedPtrObjectPool {
protected:
struct CalleeHelper {
};
public:
using Ptr = std::shared_ptr<T>;
@mightbxg
mightbxg / install_sogou_on_kubuntu.md
Last active March 12, 2024 02:25
Kubuntu 安装搜狗拼音
@mightbxg
mightbxg / utils.hpp
Last active February 22, 2023 02:54
commonly used utilities in C++
/// @brief String format from OpenCV
inline std::string format(const char* fmt, ...)
{
std::vector<char> buf(1024);
while (true) {
va_list va;
va_start(va, fmt);
int bsize = static_cast<int>(buf.size());
int len = std::vsnprintf(buf.data(), bsize, fmt, va);
va_end(va);
@mightbxg
mightbxg / QtCreator.icls
Last active August 30, 2022 11:40
QtCreator color scheme for CLion
<scheme name="QtCreator" version="142" parent_scheme="Default">
<option name="FONT_SCALE" value="1.0" />
<metaInfo>
<property name="created">2022-08-30T19:39:56</property>
<property name="ide">CLion</property>
<property name="ideVersion">2022.2.1.0.0</property>
<property name="modified">2022-08-30T19:40:01</property>
<property name="originalScheme">QtCreator</property>
</metaInfo>
<option name="CONSOLE_FONT_NAME" value="MesloLGLDZ NF" />
@mightbxg
mightbxg / make_silent_mp3.md
Created December 16, 2021 09:22
How to create a silent mp3 audio file