Skip to content

Instantly share code, notes, and snippets.

View scue's full-sized avatar
😛
Good good study, day day up!

scue scue

😛
Good good study, day day up!
View GitHub Profile
@scue
scue / main.go
Created February 23, 2020 04:02
cloudflare/tableflip Go进程热重启方法
package main
import (
"log"
"net/http"
"os"
"os/signal"
"syscall"
"github.com/cloudflare/tableflip"
@scue
scue / k8s-remove.sh
Created October 29, 2019 02:25
Remove kubernetes(centos7)
#!/bin/sh
set -x
kubeadm reset --force
yum remove -y kubeadm kubectl kubelet kubernetes-cni kube*
yum autoremove -y
[ -e ~/.kube ] && rm -rf ~/.kube
[ -e /etc/kubernetes ] && rm -rf /etc/kubernetes
[ -e /opt/cni ] && rm -rf /opt/cni
@scue
scue / net.sh
Created October 16, 2019 02:25
Linux 获取物理网卡名字(Linux list physical network interfaces by shell script)
# list physical network interfaces
ls -l /sys/class/net/ | egrep -v 'virtual|total' | awk '{print $NF}' | awk -F/ '{print $NF}'
# list physical network interfaces mac addresses
for i in $(ls -l /sys/class/net/ | egrep -v 'virtual|total' | awk '{print $NF}' | awk -F/ '{print $NF}'); do ip addr show dev $i | awk '/ether/{print $2}'; done
@scue
scue / k8s-prepare.sh
Last active October 16, 2019 07:10
适用于国内环境下,安装kubernetes、docker相关二进制,以及拉取必须的镜像文件。
#!/bin/bash
set -e
docker_install() {
type docker || curl -sSL https://get.daocloud.io/docker | sh
systemctl enable docker
systemctl start docker
# docker mirrors for china
cat << EOF > /etc/docker/daemon.json
@scue
scue / client.c
Created June 29, 2019 15:53
设定IP协议的OPTIONS内容
// Client side C/C++ program to demonstrate Socket programming
#include <stdio.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#define PORT 8080
#define MAXLINE 4096
@scue
scue / mergesort.go
Created June 28, 2019 14:23
Go语言归并排序算法
package main
import "log"
func MergeSort(a []int) []int {
l := len(a)
if l <= 1 {
return a
}
@scue
scue / subnet.set
Created April 29, 2019 03:58
ipset内网段IP集合
-N subnet hash:net
-A subnet 0.0.0.0/8
-A subnet 10.0.0.0/8
-A subnet 127.0.0.0/8
-A subnet 169.254.0.0/16
-A subnet 172.16.0.0/12
-A subnet 192.168.0.0/16
-A subnet 224.0.0.0/4
-A subnet 240.0.0.0/4
@scue
scue / README.md
Created March 13, 2019 04:06
修改GOMobile默认编译出来动态库名字(默认libgojni.so),新名字规则是lib<包名>.so

修改gomobile编译出来的动态库名字

  • 动态库命名规则:lib<包名>.so
  • 基于gomobile的ca3c58166ed802c9810ffc499b01bc1cd2e0153a commit进行修改
  • 修改文件:${GOPATH}/src/golang.org/x/mobile/cmd/gomobile/bind_androidapp.go
  • 修改完成后,执行go install -v golang.org/x/mobile/cmd/gomobile重新编译并安装gomobile二进制文件
@scue
scue / PNG2AppIcon-iOS.sh
Last active March 7, 2019 08:35
iOS应用程序图标(AppIcon.appiconset)快速制作脚本
#!/bin/sh
# PNG2AppIcon-iOS.sh
#
#
# Created by scue on 2019/3/7.
#
img_names=(
Icon1024.png
package daphne
import (
"context"
"log"
"os"
"os/exec"
"sync"
"time"
)