Skip to content

Instantly share code, notes, and snippets.

@athlum
athlum / caller_test.go
Last active January 21, 2020 07:44
runtime.Callers的benchmark代码
package test
import (
"runtime"
"sync"
"testing"
)
func inGoroutine() bool {
v := runtime.Callers(4, make([]uintptr, 1))
@athlum
athlum / format.go
Created January 21, 2020 05:16
选取string中的"[]"块,全部提前的算法
package main
import (
"strings"
)
func trimSep(sep string) string {
if sep[:2] == "[ " {
sep = "[" + sep[2:len(sep)]
}
@athlum
athlum / call.py
Created September 15, 2017 09:57
Script that call /maintenance/schedule concurrently. Replace machine name/ip and mesos master address with yours.
import requests
import json
import os
import sys
a = {
"windows" : [
{
"machine_ids" : [
{ "hostname" : "machine.a.vm", "ip" : "10.101.117.198" },