Skip to content

Instantly share code, notes, and snippets.

View Stafox's full-sized avatar
🦈

Stas K Stafox

🦈
View GitHub Profile
SELECT
nspace.nspname AS schema,
class.relname AS relation,
pg_catalog.pg_total_relation_size(class.oid) AS total_size,
pg_catalog.pg_relation_size(class.oid) AS heap_size,
CASE class.reltoastrelid WHEN 0 THEN NULL ELSE pg_catalog.pg_total_relation_size(class.reltoastrelid) END AS toast_size,
pg_catalog.pg_indexes_size(class.oid) AS idx_size,
stat_t.seq_scan AS seqscan,
stat_t.idx_scan AS idxScan,
CASE (stat_t.n_live_tup+stat_t.n_dead_tup) WHEN 0 THEN 0 ELSE (stat_t.n_tup_upd/(stat_t.n_live_tup+stat_t.n_dead_tup)::float4 * 100)::int END AS changed,
@Stafox
Stafox / gist:0fff60615a100b92bdd73c21802adb20
Last active February 20, 2020 22:17
Ubuntu 16.04 PHP 7.2 install
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2-fpm
sudo apt-get install -y php7.2
sudo apt-get -y install curl php7.2-pgsql php7.2-curl php7.2-json php7.2-mbstring php7.2-gd php7.2-intl php7.2-xml php7.2-imagick php7.2-redis php7.2-zip
# sudo systemctl disable apache2
<?php
namespace AppBundle\Extensions\Doctrine\ORM;
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\Connections\MasterSlaveConnection;
use Doctrine\DBAL\DBALException;
class ReopeningConnectionWrapper extends MasterSlaveConnection
{
@Stafox
Stafox / ParseClient.php
Last active January 13, 2017 07:42
Changed parse _request() method to return response headers
<?php
/**
* Parse\Client::_request, internal method for communicating with Parse.
*
* @param string $method HTTP Method for this request.
* @param string $relativeUrl REST API Path.
* @param null $sessionToken Session Token.
* @param null $data Data to provide with the request.
* @param bool $useMasterKey Whether to use the Master Key.
@Stafox
Stafox / gist:bc84085e135d3f8e0057
Created October 24, 2014 05:56
Links usage example
<a href="home.html" title="Home page">Home</a>
<a href="about.html" title="About me">About</a>
<a href="my-projects.html" title="My projects">Projects</a>
@Stafox
Stafox / gist:cb21bce3421257874a07
Created September 18, 2014 11:10
Retina displays
@ratio: ''; // default ratio equals to 1
@imagesPath: 'images/';
body {
background-image: url('@{imagesPath}bg@{ratio}.jpg');
}
@media screen and (-webkit-min-device-pixel-ratio: 2),
screen and (~`"-o-min-device-pixel-ratio: 2/1"`),
screen and (min--moz-device-pixel-ratio: 2),
@Stafox
Stafox / p12_to_pem
Created April 9, 2014 13:03
Generate .pem from p12
openssl pkcs12 -in server_certificates_bundle_sandbox.p12 -out server_certificates_bundle_sandbox.pem -nodes -clcerts
@Stafox
Stafox / filter device token
Last active August 29, 2015 13:58
Filter iOS device token
NSString *token = [[deviceToken description] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"<>"]];
token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"content---%@", token);
#!/bin/bash
if [ $# -eq 1 ]
then
ppa_name=`echo "$1" | cut -d":" -f2 -s`
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
Fatal error: Invalid opcode 153/1/8. in /home/***/library/Dater/Dater.php on line 87 Call Stack:
0.0000 330812 1. {main}()
/home/***/public/index.php:0 0.0188 1446344 2. Zend_Application->run()
/home/***/public/index.php:26 0.0188 1446344 3. Zend_Application_Bootstrap_Bootstrap->run() /home/***/library/Zend/Application.php:366