Skip to content

Instantly share code, notes, and snippets.

View vimiix's full-sized avatar
🧱
Coding

Vimiix Yao vimiix

🧱
Coding
View GitHub Profile
@vimiix
vimiix / go_version_manage_function.sh
Last active June 28, 2023 15:06
Shell functions for managing golang multiple versions
####### GOLANG VERSION MANAGE FUNCTIONS ######
# ref: https://go.dev/doc/manage-install
function goinstall() {
echo "Downloading go$1 ..."
go install golang.org/dl/go$1@latest && go$1 download
}
function gouse() {
gopath=$(go env GOPATH)
if test -x ${gopath}/bin/go$1; then
@vimiix
vimiix / parallel_ping.py
Last active October 19, 2021 03:35
批量发送ping包测试网络连通性
import asyncio
async def _async_ping(ip):
"""发送ping包
探测策略:发送3次包,每次间隔0.5s, 超时时间为2s
判断依据:指令执行的退出状态码是否正常为0
Args:
ip (string): IP
@the5fire
the5fire / brower.py
Created April 10, 2018 11:09
简单理解socket模拟浏览器请求
# author: the5fire.com
import re
import socket
from collections import namedtuple
RE_URL = re.compile(r'http://(.*)')
RE_CONTENT_LENGTH = re.compile(b'.*Content-Length: (\d+)')
EOF = '\r\n\r\n'
Response = namedtuple('Response', ['header', 'body'])
class MySQLCursor:
"""创建一个游标类"""
def __init__(self,cursor,logger):
self.cursor=cursor
self.logger=logger
def execute(self,sql,params=None):
self.logger.info(sql+str(params))
self.cursor.execute(sql, params)
@linar-jether
linar-jether / simple_python_datasource.py
Last active May 24, 2023 01:22
Grafana python datasource - using pandas for timeseries and table data. inspired by and compatible with the simple json datasource ---- Up-to-date version maintained @ https://github.com/panodata/grafana-pandas-datasource
from flask import Flask, request, jsonify, json, abort
from flask_cors import CORS, cross_origin
import pandas as pd
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {