Skip to content

Instantly share code, notes, and snippets.

View lbp0200's full-sized avatar
🎯
专注

刘博平 lbp0200

🎯
专注
View GitHub Profile
@lbp0200
lbp0200 / init.sh
Last active July 13, 2017 10:47
vultr startup script
apt update
#开启bbr
modprobe tcp_bbr
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
#安装必要软件
@lbp0200
lbp0200 / index.php
Last active June 30, 2017 06:25
Google Public DNS Proxy
<?php
function get_data($url)
{
$ch = curl_init();
$timeout = 10;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
@lbp0200
lbp0200 / ius.repo
Created April 28, 2017 01:30
Centos7使用IUS清华源
[ius]
name=IUS Community Packages for Enterprise Linux 7 - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/ius/stable/CentOS/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
[ius-debuginfo]
name=IUS Community Packages for Enterprise Linux 7 - $basearch - Debug
@lbp0200
lbp0200 / dev.conf
Created December 17, 2016 15:06 — forked from fnando/dev.conf
Nginx configuration for SSH tunnel
upstream tunnel {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name dev.codeplane.com br.dev.codeplane.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
@lbp0200
lbp0200 / arrayAndXML.php
Created March 30, 2016 13:42
[PHP]数组与XML互转
//xml to array
$resultXml = new SimpleXMLElement($result);
if (!$resultXml)
return ['status' => false, 'msg' => '微信支付订单生成出错'];
$resultArr = [];
foreach ($resultXml as $key => $value) {
$resultArr[$key] = strval($value);
}
/**
@lbp0200
lbp0200 / PhpStorm Keymap
Created March 21, 2016 02:21 — forked from ionauq/PhpStorm Keymap
PhpStorm快捷键
### Editing ###
`Ctrl + Space` 基本代码完成(任意类的,方法的或者变量的名称)
`Ctrl + Shift + Enter` 补全当前语句
`Ctrl + P` Parameter info (within method call arguments)
`Ctrl + Q` 快速查找文档
`Ctrl + 鼠标滑过` 简明信息查看
`Ctrl + F1` 在插入符号处显示错误或者警告信息
`Alt + Insert` 生成代码...(Getters,Setters,Constructors)
`Ctrl + O` 重写方法
`Ctrl + I` 实现方法
@lbp0200
lbp0200 / wget-jdk-oracle-install-example.txt
Created January 22, 2016 08:36 — forked from sr75/wget-jdk-oracle-install-example.txt
wget command to install Oracle JAVA JDK from stupid oracle website for centos and ubuntu
http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu
@lbp0200
lbp0200 / log.php
Last active January 9, 2016 08:18
PHP记录日志的正确姿势(linux下适用)
openlog('php program', LOG_PID, LOG_USER);
syslog(LOG_ERR, "This is a test: " . memory_get_usage(true));
@lbp0200
lbp0200 / Redis.php
Created January 2, 2016 14:43
PHP RedisClient
class Redis
{
const CONFIG_FILE = '/config/redis.php';
protected static $redis;
public static function init()
{
self::$redis = new Client(require BASE_PATH . self::CONFIG_FILE);
}
@lbp0200
lbp0200 / index.js
Last active September 21, 2015 10:34
javascript date format 日期格式化
/*
demo
today = new Date();
var dateString = today.format("dd-m-yy");
alert(dateString);
source http://jsfiddle.net/phZr7/1/
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>