Skip to content

Instantly share code, notes, and snippets.

sunliang711 /
Created June 29, 2023 03:12 — forked from irazasyed/
How to Setup dnsmasq with dnscrypt-proxy and Cloudflare DNS on macOS

How to Setup dnsmasq with dnscrypt-proxy and Cloudflare DNS on macOS

Using Laravel Valet for localhost development, So it installs dnsmasq with it. dnsmasq runs on port 53, The default DNS port. So we setup dnscrypt-proxy on port 5300 with the default config files in this gist.

dnscrypt-proxy Installation

brew install dnscrypt-proxy
sunliang711 / vim-surround使用指南.MD
Created March 24, 2023 05:37 — forked from wilon/vim-surround使用指南.MD


命令 说明 + 示例
ds 删除括号
ds " "Hello world!" =>
Hello world!
cs 替换括号
cs "( "Hello world!" =>
(Hello world!)
cS 替换括号,括号内文本做新一行
cS "{ "Hello world!" => {     Hello world! }
sunliang711 /
Created August 26, 2022 15:58 — forked from jimmychu0807/
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
sunliang711 / init.vim
Created July 13, 2021 03:12 — forked from mengwangk/init.vim
Full Neovim init.vim
"---- vim-plug setup ----
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
if has('win32')&&!has('win64')
let curl_exists=expand('C:\Windows\Sysnative\curl.exe')
let curl_exists=expand('curl')
if !filereadable(vimplug_exists)
if !executable(curl_exists)
sunliang711 / comments.lex
Created February 29, 2020 07:41 — forked from fay59/comments.lex
Tiny Flex lexer that skips C-style block comments
%option noyywrap
"/*" { BEGIN(C_COMMENT); }
<C_COMMENT>. { }
<C_COMMENT>\n { }
sunliang711 /
Created February 26, 2020 15:50 — forked from helinwang/
How to call go from c with string (char *) as the parameter without making a copy

Here is the gist for showing how to send string from c to go without a copy, for sending an float32 array from c to go without copy, please see here

Below is the documentation for converting between a c string and a go string:

// From
// A few special functions convert between Go and C types by making copies of the data. 
// Go string to C string
// The C string is allocated in the C heap using malloc.
// It is the caller's responsibility to arrange for it to be
// freed, such as by calling (be sure to include stdlib.h
sunliang711 / tmux-cheatsheet.markdown
Created August 4, 2019 11:44 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

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

Tmux 快捷键 & 速查表


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