Skip to content

Instantly share code, notes, and snippets.

View jshensh's full-sized avatar

403 Forbidden jshensh

  • 13:17 (UTC +08:00)
View GitHub Profile
@jshensh
jshensh / 断点续传.php
Last active August 3, 2017 17:10 — forked from HikoQiu/断点续传.php
PHP断点续传
// 下载
<?php
$file = './Penguins.jpg';
$file_display_name = basename($file);
$fsize = @filesize($file);
if (!empty($fsize)) {
$start = null;
$end = $fsize - 1;
if (isset($_SERVER['HTTP_RANGE']) && $_SERVER['HTTP_RANGE'] !== "" && preg_match("/^bytes=([0-9]+)-([0-9]*)$/i", $_SERVER['HTTP_RANGE'], $match) && $match[1] < $fsize && $match[2] < $fsize) {
$start = $match[1];
@jshensh
jshensh / mountdrivers.sh
Created August 3, 2017 17:27 — forked from henriqueutsch/mountdrivers.sh
Mount Driver
#sudo nano /etc/init.d/mountdrivers.sh
if [[ ! -z `mount | grep "on /media/TimeMachine type hfsplus (ro,"` ]]
then
echo "Reparando disco /media/TimeMachine em /dev/sda1"
sudo umount /dev/sda1
sudo fsck.hfsplus /dev/sda1
sudo mount -a
echo `mount | grep "on /media/TimeMachine type hfsplus (rw,"`
else
echo "Drive /media/TimeMachine montado corretamente"
@jshensh
jshensh / lnmp
Last active June 6, 2020 17:13
适用于 ssl 双向认证的 /usr/bin/lnmp
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script!"
exit 1
fi
@jshensh
jshensh / ss v2ray-plugin.md
Created June 27, 2020 10:49
ss-libev + v2ray-plugin + tls + CentOS-7

v2ray-plugin CentOS-7

ss v2ray-plugin centos-7

购买域名 / 或申请免费域名

配置 cloudflare

  1. cloudflare DNS-> 添加一条 A 记录;name=域名,value=vpsIP, ttl=automatic, status=onlyDns
@jshensh
jshensh / ApiListController.php
Last active December 22, 2020 05:30
JWT Debugger
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class ApiListController extends Controller
@jshensh
jshensh / downloadCertificate.php
Created March 11, 2021 09:48
PHP 签发客户端证书
<?php
$dn = array(
"countryName" => "CN",
"stateOrProvinceName" => "Shanghai",
"localityName" => "Shanghai",
"organizationName" => "O",
"organizationalUnitName" => "OU",
"commonName" => "Guest",
"emailAddress" => "guest@example.com"
);
@jshensh
jshensh / output
Created May 9, 2021 18:18
curl_multi_exec test
root@debian:~/php-curl-class# php test.php
Start: 1620584188.6943
curl_multi_exec: 1620584188.6959
sleep: 1620584191.6963
test1 received data at: 1620584193.697
test3 received data at: 1620584193.6971
test4 received data at: 1620584193.6979
test2 received data at: 1620584193.6989
test5 received data at: 1620584198.6994
test6 received data at: 1620584198.6994
@jshensh
jshensh / multiCurl.php
Created June 2, 2021 02:28
Multi Curl Example
<?php
// composer require jshensh/php-curl-class
require_once('./vendor/autoload.php');
use CustomCurl\Client;
var_dump(microtime(true));
$pool = [];
@jshensh
jshensh / palindrome.php
Created August 1, 2021 08:35
Find idcard number
<?php
$areaCodeList = ['110101', '110102', '110105', '110106', '110107', '110108', '110109', '110111', '110112', '110113', '110114', '110115', '110116', '110117', '110118', '110119', '120101', '120102', '120103', '120104', '120105', '120106', '120110', '120111', '120112', '120113', '120114', '120115', '120116', '120117', '120118', '120119', '130102', '130104', '130105', '130107', '130108', '130109', '130110', '130111', '130121', '130123', '130125', '130126', '130127', '130128', '130129', '130130', '130131', '130132', '130133', '130181', '130183', '130184', '130202', '130203', '130204', '130205', '130207', '130208', '130209', '130224', '130225', '130227', '130229', '130281', '130283', '130284', '130302', '130303', '130304', '130306', '130321', '130322', '130324', '130402', '130403', '130404', '130406', '130407', '130408', '130423', '130424', '130425', '130426', '130427', '130430', '130431', '130432', '130433', '130434', '130435', '130481', '130502', '130503', '130505', '130506', '130522', '130523', '130524', '
@jshensh
jshensh / create_ca_cert.sh
Last active February 28, 2022 18:07
OpenSSL 双向认证配置脚本
#!/bin/bash -e
# 创建CA根证书
# 非交互式方式创建以下内容:
# 国家名(2个字母的代号)
C=CN
# 省
ST=Shanghai
# 市
L=Shanghai