Skip to content

Instantly share code, notes, and snippets.

View inhere's full-sized avatar
😃
working, learning ...

Inhere inhere

😃
working, learning ...
View GitHub Profile
@inhere
inhere / useenv.sh
Created October 11, 2024 08:10
简单方便的实现go,node等本机sdk的多版本管理。Simple and easy to realize go, node and other local sdk multi-version management.
#!/usr/bin/env bash
# backup the PATH
pathBak="$PATH"
# echo "$BASH_VERSION"
# 声明关联数组(bash > 4.2 版本)
declare -A env_paths=(
[node20]="/c/Users/inhere/workspace/env/node-sdk/node-v20.16.0-win-x64"
[node16]="/c/Users/inhere/workspace/env/node-sdk/node-v16.16.0-win-x64"
@inhere
inhere / Telnet.php
Created July 24, 2022 08:38
implement a telnet tool class in php
<?php
/**
* Created by PhpStorm.
* User: inhere
* Date: 2017/5/9
* Time: 下午10:55
*/
namespace inhere\gearman\tools;
# link https://github.com/humbug/box/blob/master/Makefile
#SHELL = /bin/sh
# 每行命令之前必须有一个tab键。如果想用其他键,可以用内置变量.RECIPEPREFIX 声明
# mac 下这条声明 没起作用 !!
.RECIPEPREFIX = >
.PHONY: all usage help clean
# 需要注意的是,每行命令在一个单独的shell中执行。这些Shell之间没有继承关系。
# - 解决办法是将两行命令写在一行,中间用分号分隔。
# - 或者在换行符前加反斜杠转义 \
@inhere
inhere / format-mdtable2sql.php
Last active June 2, 2021 02:15
Convert table create SQL to markdown table, Convert markdown table to table create SQL
<?php
function format_mdtable2sql(string $mdStr): string
{
$lines = array_values(
array_filter(
explode("\n", trim($mdStr))
)
);
<?php declare(strict_types=1);
namespace App\Common;
use ReflectionException;
use Swoft\Bean\Annotation\Mapping\Bean;
use Swoft\Bean\Annotation\Mapping\Inject;
use Swoft\Bean\Exception\ContainerException;
use Swoft\Consul\Agent;
use Swoft\Consul\Exception\ClientException;
<?php declare(strict_types=1);
namespace App\Model\Logic;
use Exception;
use Swoft\Bean\Annotation\Mapping\Bean;
use Swoft\Breaker\Annotation\Mapping\Breaker;
/**
* Class BreakerLogic
@inhere
inhere / release-tag-new.sh
Created July 6, 2019 02:47
Release all sub-repo to new tag version and push to remote repo
#!/usr/bin/env bash
#
#
#set -e
# import common functions
source "$(dirname $0)/common-func.sh"
function show_help() {
@inhere
inhere / common-func.sh
Created July 6, 2019 02:46
some common functions for bash script usage
#!/usr/bin/env bash
# some common functions
# Usage:
# user_confirm
# user_confirm "custom question"
function user_confirm() {
local yes=0
local msg="Confirm continue"
@inhere
inhere / add-remotes.sh
Created July 6, 2019 02:44
Add the remote repository address of each component to the local remote
#!/usr/bin/env bash
#set -e
# import common functions
source "$(dirname $0)/common-func.sh"
binName="bash $(basename $0)"
if [[ -z "$1" ]]