Skip to content

Instantly share code, notes, and snippets.

View jorben's full-sized avatar
:fishsticks:

脚本小哥 jorben

:fishsticks:
View GitHub Profile
@jorben
jorben / clear_time_wait.sh
Created January 21, 2019 01:35
高并发应用服务大量TIME_WAIT状态优化方法
#CLOSED:无连接是活动的或正在进行
#LISTEN:服务器在等待进入呼叫
#SYN_RECV:一个连接请求已经到达,等待确认
#SYN_SENT:应用已经开始,打开一个连接
#ESTABLISHED:正常数据传输状态
#FIN_WAIT1:应用说它已经完成
#FIN_WAIT2:另一边已同意释放
#ITMED_WAIT:等待所有分组死掉
@jorben
jorben / watchdog.sh
Created April 24, 2018 06:40
Linux下为重要的进程创建监控脚本watchdog.sh
#! /bin/sh
PRO_NAME=frpc
NOW=`date +'%Y-%m-%d %H:%M:%S'`
# while true; do
NUM=`ps aux | grep ${PRO_NAME} | grep -v grep | wc -l `
if [ "${NUM}" -lt "1" ]; then
echo "${NOW} ${PRO_NAME} was dead!"
nohup ./${PRO_NAME} -c ../etc/frpc.ini &
echo "${NOW} restart ok!"
elif [ "${NUM}" -gt "1" ]; then
@jorben
jorben / decimal.php
Last active August 11, 2022 08:21
PHP 10进制和36进制转换
if (!function_exists('base36_encode')) {
/**
* 十进制数转换成三十六进制数
* @param (int)$num : 十进制数
* return (string) :三十六进制数
*/
function base36_encode($num)
{
$num = intval($num);
if ($num < 0)
@jorben
jorben / remove_xss.php
Created October 12, 2017 09:28
php xss过滤
<?php
function removeXSS($val) {
// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed
// this prevents some character re-spacing such as <java\0script>
// note that you have to handle splits with \n, \r, and \t later since they *are* allowed in some inputs
$val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val);
// straight replacements, the user should never need these since they're normal characters
// this prevents like <IMG SRC=@avascript:alert('XSS')>
@jorben
jorben / wechat_deleted_friends.py
Created October 12, 2017 09:26
检查微信单向好友工具
#!/usr/bin/env python
# encoding: utf-8
"""
查看被删的微信好友
@link: https://github.com/0x5e/wechat-deleted-friends
"""
from __future__ import print_function
@jorben
jorben / echarts_radar_config.js
Created August 11, 2017 08:26
echart V3 版雷达配置
// echarts V3 版本
option = {
title: {
text: '多维度雷达图展示'
},
tooltip: {show: true},
legend: {
data: ['期望', '实际']
},
radar: {
@jorben
jorben / ssh_scp_proxy.md
Created June 2, 2017 09:42
SSH\SCP通过代理连接目标服务器

一、SSH over http

Corkscrew是专门为ssh提供http代理的软件,要使用corkscrew需要http代理支持HTTP CONNECT方法,建议使用squid或者ATS这类专业的代理软件,代理不建议设置认证

1.1 Corkscrew安装

下载:

wget http://agroman.net/corkscrew/corkscrew-2.0.tar.gz 编译安装:

@jorben
jorben / get_attach_pid.sh
Created January 5, 2017 01:50
有时候看到某个shm有好几个进程attach了,但是具体是哪些进程呢? 网上查了一下,http://stackoverflow.com/questions/5658568/how-to-list-processes-attached-to-a-shared-memory-segment-in-linux 方法是grep $shmid /proc/*/maps 可以找出attach的进程。
#!/bin/bash
if [ $# -lt 1 ]; then
echo "usage: " $0 " shmid ..."
exit 0
fi
tmpfile=/tmp/shm$$
for x ; do
@jorben
jorben / win_dush.bat
Created October 16, 2016 08:24
windws 下统计指定目标路径下各文件夹的大小
@echo off
IF [%1]==[] GOTO USAGE
if NOT exist "%1" (ECHO "%1" path not exist & GOTO END)
:DIR_PATH
dir /ad /b %1 > 1.txt
@jorben
jorben / p2webp.pl
Last active August 19, 2016 18:47
subversion明文密码转apache支持的webpasswd
#!/usr/bin/perl
# write by jorbenzhu, 2016-08-19
use warnings;
use strict;
open (FILE, "passwd") or die ("Can't open the passwd file!");
open (OUT_FILE, ">webpasswd") or die ("Can't open the webpasswd file!");