Skip to content

Instantly share code, notes, and snippets.

View samayo's full-sized avatar
💬
drink more water

Samson Daniel samayo

💬
drink more water
View GitHub Profile
@samayo
samayo / 1nginx.conf
Created September 13, 2019 23:08 — forked from josephbolus/1nginx.conf
Wordpress Nginx Config
# ---------------------------------------
# Main Module
# ---------------------------------------
user nginx;
# This number should be, at maximum, the number of CPU cores on your system.
worker_processes 2;
pid /var/run/nginx.pid;
# Only log critical errors
@samayo
samayo / 00_ReadMe.md
Created October 17, 2018 21:57 — forked from mohamed-el-habib/00_ReadMe.md
drupal fpm with nginx and mysql

Usage

git clone git://github.com/fd57d8aa59b1574ee7728edf128814d3.git docker-drupal-fpm
cd docker-drupal-fpm
mkdir -p /usr/local/share/dockervolumes/drupal # if you change this folder please update the run.sh

chmod +x run.sh && ./run.sh up

@samayo
samayo / install-ruby.sh
Created June 20, 2016 13:39 — forked from lukearmstrong/install-ruby.sh
Install enough to get Ruby and Sass working on RHEL/CentOS
# lol redhat
su
# Install deps
yum install libyaml libyaml-devel openssl libxml2-devel bison libxslt-devel openssl-devel tcl tk libffi tcl-devel tk-devel libffi-devel
# Download Ruby
cd /usr/local/src/
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -xvzf ruby-1.9.3-p392.tar.gz
@samayo
samayo / phpixie-stats.php
Created May 10, 2016 15:26 — forked from AndrewCarterUK/phpixie-stats.php
Script used to verify fraudulent installs on PHPixie.
<?php
function getJsonPage($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
@samayo
samayo / daemon_example.py
Created April 21, 2016 11:41 — forked from slor/daemon_example.py
An example of a Linux daemon written in Python. Based on http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python
""" An example of a Linux daemon written in Python.
Based on http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
The changes are:
1 - Uses file open context managers instead of calls to file().
2 - Forces stdin to /dev/null. stdout and stderr go to log files.
3 - Uses print instead of sys.stdout.write prior to pointing stdout to the log file.
4 - Omits try/excepts if they only wrap one error message w/ another.
@samayo
samayo / README.md
Created November 3, 2015 01:07 — forked from scottpnelson/README.md
Automatic MySQL database setup from .env file contents

About

This script will automatically create a new MySQL database for you by reading your MySQL database name, host name, and user credentials from your .env file. This allows you to keep your database details safe, in a single location. Ideal for deployment and security.

Installation

1. Download setup_mysql.sh to your project root directory 2. You can modify setup_mysql.sh to set the following: - ENV_FILE (the relative path to your .env file -- e.g. ENV_FILE="./.env.local") - DEFAULT_MYSQL_HOST (the host name of your MySQL server -- e.g. "localhost") - DEFAULT_MYSQL_ADMIN_USERNAME (the administrator username of your mysql server -- e.g. "root" (note: this is typically NOT the MySQL username of your app). This should be no longer than 16 characters. Some versions of MySQL allow for longer lengths. You can modify the MAX_MYSQL_USERNAME_LENGTH variable to change this length. - DEFAULT_MYSQL_ADMIN_PASSWORD (the administrator password of your mysql admin user -- e.g
@samayo
samayo / php.sh
Last active August 28, 2015 20:13 — forked from kelunik/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
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;

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
[
{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'},