Skip to content

Instantly share code, notes, and snippets.

@jordiwes
jordiwes / postgres-cheatsheet.md
Created February 17, 2021 19:34 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@jordiwes
jordiwes / www-install.sh
Created January 22, 2020 22:50 — forked from jdukleth/www-install.sh
[ Nginx + PHP-FPM + ODBC + WWW Menu ] Installation & Configuration on IBM i
#!/bin/bash
###################################################
# HOW TO RUN THIS SCRIPT
# copy this script to target server
# run these commands from a bash terminal:
# `cd /path/to/folder`
# `chmod +x www-install.sh`
# `./www-install.sh`
# if you want to overwrite .nginx/.php folders:
stop;
-- Publish the data within a table using SQL
with json_rows (j) as (
select json_object(
key 'EMPNO' value empno, key 'FIRSTNME' value firstnme,
key 'MIDINIT' value midinit, key 'LASTNAME' value lastname,
key 'WORKDEPT' value workdept, key 'PHONENO' value phoneno,
key 'HIREDATE' value hiredate, key 'JOB' value job,
@jordiwes
jordiwes / gunicorn_service.py
Created October 31, 2018 13:35 — forked from TheWaWaR/gunicorn_service.py
Gunicorn service script {Start | Restart | Stop | Reload | Quit}
#!/usr/bin/env python
#coding: utf-8
import os
import imp
import time
import signal
import argparse
import commands
@jordiwes
jordiwes / compileIconvPHPExtension.sh
Created September 16, 2016 19:20 — forked from phpdave/compileIconvPHPExtension.sh
Compile iconv php extension on IBMi
#1 get latest iconv php extension which is included in the php-src
git clone http://git.php.net/repository/php-src.git
#2.0 find your PHP Version
php -v
#2.1 check out your specific branch of PHP
git checkout PHP-5.6.7
#3 If you dont have libiconv.a, Get libiconv from perzl and then fix it
@jordiwes
jordiwes / LearnAboutYourPHPCLI.sh
Created March 11, 2016 15:52 — forked from phpdave/LearnAboutYourPHPCLI.sh
Learn about your php cli setup
# learn what php-cli is doing
cat /usr/local/zendsvr/bin/php-cli
# learn what configuration values are set
cat /etc/zce.rc
# learn what extensions are enabled in php.ini
cat /usr/local/zendsvr/etc/php.ini | grep extension
# see extensions included
/usr/local/zendsvr/bin/php-cli -r "phpinfo();" | grep conf.d
# things you should probably create for setting up php-cli specific configuration
@jordiwes
jordiwes / IbmiToolkit_Module.php
Created September 23, 2015 22:04 — forked from chukShirley/IbmiToolkit_Module.php
ZF2 IBM i Toolkit module
<?php
namespace IbmiToolkit;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
class Module
{
public function onBootstrap(MvcEvent $e)
{
class ItemsGateway extends AbstractGateway
{
protected $table = 'SCF906';
public function fetchAll()
{
// Try to fetch from the cache first
$response = zend_shm_cache_fetch('itemCodes');
// If itemCodes list isn't in cache
<?php
namespace Sabel;
abstract class AbstractController
{
protected $diContainer;
public function __construct(DiContainer $diContainer){
$this->diContainer = $diContainer;
}
<?php
abstract class AbstractValue
{
protected $value;
private function __construct(){}
protected function filter()
{