Skip to content

Instantly share code, notes, and snippets.

@pankpan
pankpan / gist:d2ae7201ffc0761bcb97fde312049d4d
Last active May 23, 2016 17:27
nginx default.conf sample
server {
listen 80;
listen 443 ssl;
server_name yourhost.com;
ssl_certificate /etc/nginx/ssl/cert_chain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
root /var/www/html;
charset UTF-8;
access_log /var/log/nginx/log/host.access.log main;
location / {
# cat json
{"a":1,"b":2,"c":3,"d":4,"e":5}
# cat json | python -m json.tool
{
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5
}
# cat xml
<?xml version="1.0"?><package><name>ssh2</name><channel>pecl.php.net</channel><summary>Bindings for the libssh2 library</summary></package>
# cat xml | xmllint --format -
<?xml version="1.0"?>
<package>
<name>ssh2</name>
<channel>pecl.php.net</channel>
<summary>Bindings for the libssh2 library</summary>
</package>
# cat xml | xmlstarlet fo
@pankpan
pankpan / linebot.php
Last active May 30, 2016 16:13
LINE BOT PHP Sample
$channel_id="xxxxxxxxxx";
$channel_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$channel_mid="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$endpoint_url="https://trialbot-api.line.me/v1/events";
$arr=json_decode(file_get_contents("php://input"),1);
$from=$arr['result'][0]['content']['from'];
$text=$arr['result'][0]['content']['text'];
$post_data="{\"to\":[\"$from\"],\"toChannel\":1383378250,\"eventType\":\"138311608800106203\",\"content\":{\"contentType\":1,\"toType\":1,\"text\":\"$text\"}}";
$ch=curl_init();
$headers=array("Content-Type: application/json; charser=UTF-8","X-Line-ChannelID: $channel_id","X-Line-ChannelSecret: $channel_secret","X-Line-Trusted-User-With-ACL: $channel_mid");
{
"result": [
{
"toChannel": 1111111111,
"to": [
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
],
"id": "WB1519-xxxxxxxxxx",
"fromChannel": 1111111111,
"from": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
@pankpan
pankpan / nginx.repo
Created November 21, 2017 01:47
nginx repo for CentOS
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
@pankpan
pankpan / Caddyfile
Last active August 12, 2019 09:56
Caddyfile sample
https://domain1.com https://www.domain1.com {
root /var/www/html
log /var/log/caddy/access.log
errors /var/log/caddy/errors.log
tls your@email.com # auto https with let's encrypt
gzip
fastcgi / localhost:9000 php
}
https://domain2.com https://www.domain2.com {
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
{
"settings": {
"baseUrl": "https://desktop.line-scdn.net/win/v1/real",
"lineUrl": "https://desktop.line-scdn.net/win/v1/real/light",
"fileName": "LINE.zip",
"regression": false,
"legacyUpgraderUrl": "https://desktop.line-scdn.net/win/v1/real/legacy/LineUpgrader.exe"
},
"shared": {
"baseUrl": "https://desktop.line-scdn.net/win/v1/real/shared",
@pankpan
pankpan / vhost.conf
Last active June 1, 2021 14:10
Multi-PHP version on the same server
<VirtualHost *:80>
DocumentRoot "/var/www/php56"
ServerName php56.local
ErrorLog "logs/php56_error_log"
CustomLog "logs/php56_access_log" combined
<FilesMatch \.php$>
setHandler "proxy:unix:/var/opt/remi/php56/run/php-fpm/www.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>