Skip to content

Instantly share code, notes, and snippets.

Avatar
💬
drink more water

samayo samayo

💬
drink more water
View GitHub Profile
@samayo
samayo / php.sh
Last active Aug 28, 2015 — forked from kelunik/php.sh
View php.sh
#!/bin/bash
set -e
set -x
if [ $1 == "master" ]
then
wget https://github.com/php/php-src/archive/master.zip -q -O master.zip
rm -rf php-src-master
unzip -q master.zip
@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
@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 {
View postgres-cheatsheet.md

Magic words:

psql -U postgres

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

  • \q: Quit/Exit
  • \c __database__: Connect to a database
  • \d __table__: Show table definition including triggers