Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Yilong Li dragonly

🎯
Focusing
View GitHub Profile
@dragonly
dragonly / stringcopy.go
Created May 25, 2021
test golang copy string will not consume large memory
View stringcopy.go
package main
import (
"time"
"fmt"
"strings"
)
func main() {
var sb strings.Builder
for i := 0; i < 10000000; i++ {
sb.WriteString("test")
View wg0.conf on local server
[Interface]
PrivateKey = x
Address = 192.168.2.5/24
ListenPort = 21841
[Peer]
PublicKey = x
Endpoint = $public_ip:51820
AllowedIPs = 192.168.2.0/24
@dragonly
dragonly / gist:a0ff782d85406cf0ef2f5d74d4f4997c
Created Dec 4, 2020 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:a0ff782d85406cf0ef2f5d74d4f4997c

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
View profile.py
profile = cProfile.Profile()
profile.enable()
'''
code to profile
'''
profile.disable()
s = io.StringIO()
ps = pstats.Stats(profile, stream=s).sort_stats('tottime').reverse_order()
@dragonly
dragonly / tricky_chrome_debugger.html
Last active Jul 14, 2018
tricky chrome debugger
View tricky_chrome_debugger.html
<html>
<body>
Just open the chrome debugger and see wierd things
<script>
let x = {
x: {
x: 1
}
}
console.log(x.x.x)
@dragonly
dragonly / vimrc
Created Jan 28, 2018
in addition to amix/vimrc
View vimrc
let g:go_version_warning = 0
let g:syntastic_check_on_wq = 0
# let g:syntastic_c_include_dirs = ["/usr/local/cuda/include"]
let g:NERDTreeWinPos = "left"
let g:NERDTreeWinSize = 20
let g:syntastic_loc_list_height = 5
set nu
set tabstop=2
set shiftwidth=2
set expandtab
@dragonly
dragonly / zshrc
Last active Jan 28, 2018
~/.zshrc with oh-my-zsh
View zshrc
export EDITOR=vim
export LC_ALL=en_US.UTF-8
export TERM=xterm-256color
# add timestamp to the right
export RPROMPT="%{$fg_bold[green]%}%D{%m-%f} %*%{$reset_color%}"
@dragonly
dragonly / pretty git log
Last active Jun 24, 2020
git log visualization
View pretty git log
# put this in your ~/.gitconfig, then issue `git lg` will get you a pretty git branch topology view
#
# this is just a start point, customizations can be done by further fine tuning referencing
# https://git-scm.com/docs/git-log & https://git-scm.com/docs/pretty-formats
#
# --graph draws the git commits tree
# --date=local is used in the following --format
#
# format explanation:
# %C(colorname)xxx%C(reset) encloses text `xxx` with color `colorname`
@dragonly
dragonly / ctags_with_dep.sh
Last active Jul 23, 2016 — forked from xuhdev/ctags_with_dep.sh
Generate ctags file for C or C++ files and its depedencies (included header files). This could avoid you to always generate a huge tags file.
View ctags_with_dep.sh
#!/bin/bash
function usage() {
echo "Usage:"
echo " ./ctags_with_dep.sh file1.c file2.cpp"
}
CFLAGS="`pkg-config --cflags ImageMagick++ freetype2 fontconfig assimp` -I../Include -IFreetypeGL -I../Common/FreetypeGL"
if [ -n "$1" ]; then
@dragonly
dragonly / rvalue.cpp
Created Apr 21, 2016
test rvalue related behaviors of C++11
View rvalue.cpp
#include <iostream>
using namespace std;
class Foo
{
public:
Foo() { cout << "Foo::ctor" << endl; }
Foo(Foo &foo) { cout << "Foo:copy" << endl; }
~Foo(){ cout << "Foo::dtor" << endl; }