Skip to content

Instantly share code, notes, and snippets.

View jorben's full-sized avatar
:fishsticks:

脚本小哥 jorben

:fishsticks:
  • Shenzhen
View GitHub Profile
@jorben
jorben / grep_port.sh
Created August 10, 2016 08:02
根据端口抓捕低频发包进程
#!/bin/bash
i=1
while(($i>0))
do
pid=''
PSPID=''
GOTED=`ss -natp|grep ESTAB|grep -E ":9003 "`
@jorben
jorben / openssl_tool.txt
Last active December 27, 2024 01:38
RSA加解密,签名、验签文件
1) Generate RSA key:
$ openssl genrsa -out key.pem 1024
$ openssl rsa -in key.pem -text -noout
2) Save public key in pub.pem file:
$ openssl rsa -in key.pem -pubout -out pub.pem
$ openssl rsa -in pub.pem -pubin -text -noout
3) Encrypt some data:
@jorben
jorben / go.exp
Created June 2, 2016 07:26
远程批量执行脚本
#!/usr/bin/expect -f
set type [lindex $argv 0 ]
set ip [lindex $argv 1 ]
set cmd [lindex $argv 2 ]
set timeout 10
if { $ip == "" } {
puts "Usage: go web 1.2.3.4"
puts "Usage: go app 1.2.3.4 dev"
puts "Usage: go tws 10.137.15.150,10.198.133.45 'uptime'"
@jorben
jorben / PLog.class.php
Created December 5, 2015 15:42
SAE日志类,日志存数据库方便查阅,适用于php,支持同账户下跨应用(多个应用使用同一个db表)
<?php
/*
-- SQL
DROP TABLE IF EXISTS `t_logs`;
CREATE TABLE IF NOT EXISTS `t_logs` (
`f_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`f_level` tinyint(4) NOT NULL,
`f_module` varchar(128) NOT NULL,
`f_time` int(10) unsigned NOT NULL,
`f_path` varchar(256) NOT NULL,
@jorben
jorben / log_mmap.c
Last active June 8, 2022 12:26
mmap写文件,多进程
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
@jorben
jorben / get_local_addr.c
Last active December 3, 2015 01:38
巧妙的获取本机ip地址
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
char* get_local_addr(char* buf, size_t len);
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/epoll.h>
@jorben
jorben / git_toturial
Created November 27, 2015 02:15 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "[email protected]" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://[email protected]/VT.git # clone远程仓库
@jorben
jorben / select_server.c
Last active November 12, 2015 10:37
tcp select模型服务端示例
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/select.h>