Skip to content

Instantly share code, notes, and snippets.

@lixianyang
lixianyang / qsort.c
Created July 16, 2017 06:04
快速排序,c语言实现(基础版)
# include <stdio.h>
void swap(int v[], int i, int j){
int temp = v[i];
v[i] = v[j];
v[j] = temp;
}
void qsort(int v[], int left, int right){
int i, last;
@lixianyang
lixianyang / README-Template.md
Created August 28, 2017 08:00 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

29585: /usr/bin/ruby2.3 -Eascii-8bit:ascii-8bit /usr/local/bin/fluentd -c /fluentd/etc/fluent.conf -p /fluentd/plugins --under-supervisor
Address Kbytes Mode Offset Device Mapping
00007f3e4e000000 6144 rw--- 0000000000000000 000:00000 [ anon ]
00007f3e4e600000 4096 rw--- 0000000000000000 000:00000 [ anon ]
00007f3e4ea00000 14336 rw--- 0000000000000000 000:00000 [ anon ]
00007f3e4f800000 16384 rw--- 0000000000000000 000:00000 [ anon ]
00007f3e50800000 2048 rw--- 0000000000000000 000:00000 [ anon ]
00007f3e50a00000 2048 rw--- 0000000000000000 000:00000 [ anon ]
00007f3e50c00000 4096 rw--- 0000000000000000 000:00000 [ anon ]
00007f3e51000000 2048 rw--- 0000000000000000 000:00000 [ anon ]
@lixianyang
lixianyang / prometheus-metrics-to-md.py
Created January 16, 2019 06:01
prometheus metrics to markdown help
# coding: utf-8
import sys
import requests
def get_metrics_string(url):
""" get metrics content """
r = requests.get(url)
@lixianyang
lixianyang / ohmyzsh-config.txt
Created May 23, 2020 08:52
ohmyzsh 粘贴卡顿
https://github.com/zsh-users/zsh-autosuggestions/issues/238#issuecomment-389324292
```shell
# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
@lixianyang
lixianyang / defer_and_return.go
Created November 10, 2020 06:59
defer 里修改返回值的几种情况
package main
import (
"fmt"
)
func main() {
fmt.Println(f())
fmt.Println(f1())
fmt.Println(f2())
// Single line comment
/* Multi-
line comment */
// A package clause starts every source file.
// Main is a special name declaring an executable rather than a library.
package main
// Import declaration declares library packages referenced in this file.
import (
@lixianyang
lixianyang / get-token-for-serviceaccount.sh
Created April 14, 2021 09:17
create root token for kubernetes apiserver
admin_account="k8s-cyk-admin"
kubectl create serviceaccount ${admin_account} -n kube-system
kubectl create clusterrolebinding ${admin_account} --clusterrole=cluster-admin --serviceaccount=kube-system:${admin_account}
kubectl -n kube-system describe secrets $(kubectl -n kube-system get secret | grep ${admin_account} | awk '{print $1}')
@lixianyang
lixianyang / gist:f913365bcaa7daca49af5eb023f35714
Created May 13, 2021 06:05
terminator 配置文件 ~/.config/terminator/config
[global_config]
window_state = maximise
title_use_system_font = False
title_font = Sans 15
[keybindings]
[profiles]
[[default]]
background_color = "#ffe4e1"
background_darkness = 0.85
background_type = transparent
@lixianyang
lixianyang / windows open vt-x in vritualbox
Created September 17, 2021 07:38
VMBoxManage command cannot enable nested vt-x/amd-v without nested-paging and unrestricted guest execution
* run this at command prompt: bcdedit /set hypervisorlaunchtype off
* turn off windows feature "Virtual Machine Platform"
* reboot
ref: https://github.com/GNS3/gns3-gui/issues/3032#issuecomment-672571302