Skip to content

Instantly share code, notes, and snippets.

Avatar
💬
drink more water

samayo samayo

💬
drink more water
View GitHub Profile
@samayo
samayo / gist:8339642
Created Jan 9, 2014
testing visithor
View gist:8339642
<?php
class VisiThorGraph{
function __construct($myFile){
$this->myFile = new SplFileObject($myFile);
}
function getTotalCount(){
$count = null;
while(!$this->myFile->eof()){
$explode = explode('#', str_replace("\n", "", $this->myFile->fgets()));
if(!empty($explode[1])){
@samayo
samayo / gist:9504908
Created Mar 12, 2014
Comparing style
View gist:9504908
<?php
$a->crop(["width"=>100, "height"=>100])
->watermark('logo.png')
->upload($_FILES["name"]);
# compare with below approach.
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
View init.d
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@samayo
samayo / bash
Created Dec 18, 2014
mariadb error
View bash
$ yum -y update
$ yum -y install cmake glibc.i686 ncurses-devel
$ wget https://downloads.mariadb.org/f/mariadb-5.5.40/source/mariadb-5.5.40.tar.gz
$ tar xzvf mariadb-5.5.40.tar.gz
$ cd mariadb-5.5.40
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DMYSQL_TCP_PORT=3306 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mariadb/data -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=1 -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_ZLIB=system
@samayo
samayo / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View countries.json
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@samayo
samayo / init
Created Apr 11, 2015
nginx daemon
View init
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# pidfile: /var/run/nginx.pid
View server.conf
server {
listen 80;
server_name example.com dev.example.com;
root /var/www/sites/public/dev.example/;
index index.html index.htm index.php;
access_log /var/log/nginx/example.com_access.log;
error_log /var/log/nginx/example.com_error.log;
charset utf-8;
@samayo
samayo / nginx.conf
Created Apr 11, 2015
Nginx configuration file
View nginx.conf
user nginx;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {