Skip to content

Instantly share code, notes, and snippets.

Smowtion Thomanphan

View GitHub Profile
@Thomanphan
Thomanphan / php-fpm-nginx-errorlog.md
Created Jul 24, 2018 — forked from joerx/php-fpm-nginx-errorlog.md
redirect php-fpm output to nginx's error log
View php-fpm-nginx-errorlog.md
  • php process is wrapped like this: PHP file -> php-fpm -> nginx
  • basically means disable all facilities that catch output from the script on it's way to nginx
  • standard error output will the end in Nginx's logging facility

On CentOS

  • make sure your script does not set error_log
  • edit /etc/php-fpm.conf, disable line error_log = /var/log/php-fpm/error.log
  • edit /etc/php-fpm.d/www.conf, disable line starting with php_admin_value[error_log] = ...
  • restart fpm: systemctl restart php-fpm
View ssl-protocol-cipher.conf
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA:!DES-CBC3-SHA;
View nginx.cnf
server {
listen 80;
server_name domain.com www.domain.com;
rewrite ^(.*) https://domain.com$1 permanent;
}
server {
listen 443 ssl http2;
server_name www.domain.com;
ssl_certificate /etc/nginx/paidssl/domain.com/domain.com.crt;
@Thomanphan
Thomanphan / svg2icns
Created May 20, 2018 — forked from zlbruce/svg2icns
covert svg to icns (with imagemagick)
View svg2icns
#!/bin/bash
echo "*** SVG 2 ICNS ***"
if [ $# -ne 1 ]; then
echo "Usage: svg2icns filename.svg"
exit 100
fi
filename="$1"
name=${filename%.*}
ext=${filename##*.}
echo "processing: $name"
View gist:6bee985f71f342a773b9d829ee8ab208
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>[VIP Exclusive] Gael Breton, Perrin Carrell – The Authority Site System $497</title>
<script src="/cdn-cgi/apps/head/yWhojLTrnH_uPURAVzoPEG9BKrM.js"></script><script type="text/javascript">
//<![CDATA[
window.__cfRocketOptions = {byc:0,p:0,petok:"8ed06bfd0e09014cd52fcaddcb51474fc2d1b0ba-1524819050-1800"};
//]]>
View gist:7af842360e2bd4f370c22b07f328f5a9
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>(GET) Persuasion Secrets of the World’s Most Charismatic and Influential Villains by Ben Settle</title>
<script src="/cdn-cgi/apps/head/yWhojLTrnH_uPURAVzoPEG9BKrM.js"></script><script type="text/javascript">
//<![CDATA[
window.__cfRocketOptions = {byc:0,p:0,petok:"5ebaaa8dc2a7856d2056f97e9565b6ce6a9000be-1524818515-1800"};
//]]>
@Thomanphan
Thomanphan / ResizeImage.php
Created Mar 26, 2018 — forked from egulhan/ResizeImage.php
Resize Image Class With PHP
View ResizeImage.php
<?php
// @source: http://www.paulund.co.uk/resize-image-class-php
/**
* Resize image class will allow you to resize an image
*
* Can resize to exact size
* Max width size while keep aspect ratio
* Max height size while keep aspect ratio
* Automatic while keep aspect ratio
View Fahrenheit to Celsius.html
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Functions</h2>
<p>This example calls a function to convert from Fahrenheit to Celsius:</p>
<p id="demo"></p>
<script>
function toCelsius(f) {
View Database.singleton.php
<?php
# Name: Database.singleton.php
# File Description: MySQL Singleton Class to allow easy and clean access to common mysql commands
# Author: ricocheting
# Web: http://www.ricocheting.com/
# Update: 2010-07-19
# Version: 3.1.4
# Copyright 2003 ricocheting.com
You can’t perform that action at this time.