Skip to content

Instantly share code, notes, and snippets.

View mightbxg's full-sized avatar

Xinguang Bian mightbxg

  • Nanjing, Jiangsu, China
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 21, 2024 01:45
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Starefossen
Starefossen / tmux-cheats.md
Last active June 21, 2024 17:26
My personal tmux cheat sheet for working with sessions, windows, and panes. `NB` I have remapped the command prefix to `ctrl` + `a`.

Sessions

New Session

  • tmux new [-s name] [cmd] (:new) - new session

Switch Session

  • tmux ls (:ls) - list sessions
  • tmux switch [-t name] (:switch) - switches to an existing session
@engie
engie / shared_ptr_pooling.cpp
Created September 25, 2013 12:17
Notes on pooling shared ptr's
//Storing shared pointers in boost pool allocators
//tl;dr It just works (tm)
//
//* If a lot of smallish objects are being allocated & freed a pool allocator
//can speed things up by specialising in allocating exactly that size of
//object.
//
//* If pointer lifetimes need to be managed with reference counting,
//std::shared_ptr can wrap an object to provide safe reference counting.
//
@ianhomer
ianhomer / curl-ipv4.sh
Last active June 17, 2024 03:56
Force CURL to use ipv4
# curl not smart enough for ipv6, so force ipv4
# on my mac I started to get localhost connect failure
#
# curl: (7) Failed to connect to localhost port 9031: Connection refused
echo '--ipv4' >> ~/.curlrc
@karpathy
karpathy / min-char-rnn.py
Last active June 21, 2024 13:50
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@horiken4
horiken4 / gist:5f40ed1e769da4d412d4
Created November 20, 2015 10:57
Solve curve fitting problem by OpenCV CvLevMarq
#include <opencv2/opencv.hpp>
#include <random>
using namespace std;
using namespace cv;
void make_samples(int num, double xlb, double xub, Mat param,
vector<Vec2d>& samples) {
random_device rd;
mt19937 mt(rd());
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active June 21, 2024 06:04 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@matthewjberger
matthewjberger / instructions.md
Last active June 20, 2024 19:27
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@pavel-perina
pavel-perina / fixed_aspect_ratio_qlayout.h
Last active June 15, 2023 12:33
QLayout that keeps fixed aspect ratio of it's only widget.
/*
Copyright (c) 2017 Pavel Perina
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active June 19, 2024 00:04
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux