Skip to content

Instantly share code, notes, and snippets.

@feinar
feinar / UUID.php
Created May 19, 2020 11:54 — forked from dahnielson/UUID.php
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@feinar
feinar / git-pull-all
Created April 22, 2020 11:08 — forked from grimzy/git-pull-all
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@feinar
feinar / deployment_guide.md
Created March 30, 2020 17:21 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@feinar
feinar / my.cnf
Created March 11, 2020 20:07 — forked from yadvr/my.cnf
Example MySQL my.cnf optimized
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
syslog
@feinar
feinar / install-comodo-ssl-cert-for-nginx.rst
Created September 6, 2019 12:17 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@feinar
feinar / header_http_status_codes.php
Created May 30, 2019 14:27 — forked from phoenixg/header_http_status_codes.php
PHP header() for sending HTTP status codes
<?php
/*
参考自:
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function
http://snipplr.com/view/68099/
*/
function HTTPStatus($num) {
$http = array(
@feinar
feinar / Help page
Created March 22, 2019 15:32
Nginx+Letsencrypt=Easily
https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
@feinar
feinar / simpleXmlToArray.php
Created September 12, 2018 06:55 — forked from jasondmoss/simpleXmlToArray.php
Convert a SimpleXML object to associative array
<?php
/**
* Convert a SimpleXML object to an associative array
*
* @param object $xmlObject
*
* @return array
* @access public
*/
@feinar
feinar / fastcgi_params
Created September 6, 2018 14:36 — forked from anthonysomerset/fastcgi_params
nginx https if statement for fastcgi_params
set $ssl off;
if ($ssl_protocol != "" ) {
set $ssl on;
}
fastcgi_param HTTPS $ssl;
@feinar
feinar / gist:7a69779bd3416960c836715bde059073
Created July 24, 2018 08:47 — forked from niieani/gist:1213709
PHP Camel Case functions
<?php
// source: http://www.paulferrett.com/2009/php-camel-case-functions/
/**
* Translates a camel case string into a string with underscores (e.g. firstName -&gt; first_name)
* @param string $str String in camel case format
* @return string $str Translated into underscore format
*/
function from_camel_case($str) {
$str[0] = strtolower($str[0]);