Skip to content

Instantly share code, notes, and snippets.

@tebajanga
tebajanga / containers_status.sh
Created June 21, 2020 10:38
Docker status of all containers
docker ps -q | xargs docker stats
@tebajanga
tebajanga / gist:04b7e314979c7a45f00b4c56702fe2af
Created April 6, 2020 09:57 — forked from maccath/gist:3981205
Split PDF to individual pages using FPDI and FPDF
<?php
/**
* Split PDF file
*
* <p>Split all of the pages from a larger PDF files into
* single-page PDF files.</p>
*
* @package FPDF required http://www.fpdf.org/
* @package FPDI required http://www.setasign.de/products/pdf-php-solutions/fpdi/
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
# Last commit
git log master..{branch_name} --oneline | tail -1
# First commit
git log master..{branch_name} --oneline | head -1
# Last commit
git log master..{branch_name} --oneline | tail -1
# First commit
git log master..{branch_name} --oneline | head -1
@tebajanga
tebajanga / Procfile
Created October 19, 2019 21:48 — forked from sdrew/Procfile
Laravel configs for Heroku/Dokku
web: vendor/bin/heroku-php-apache2 public/
@tebajanga
tebajanga / postgres-cheatsheet.md
Created March 25, 2019 22:27 — 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)
@tebajanga
tebajanga / LaravelInstaller.sh
Last active February 27, 2019 22:36
Installing Laravel Globally by using Composer for Ubuntu
# Getting composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# Changing permission for .composer directory
sudo chown -R $USER ~/.composer/
# Installing Laravel Global
composer global require "laravel/installer"
# Adding composer to system PATH
<?php
// Turn on debugging level
$Vtiger_Utils_Log = true;
include_once 'vtlib/Vtiger/Module.php';
error_reporting(E_ALL);
ini_set("display_errors", "on");
$current_user = Users::getActiveAdminUser();
include_once 'modules/cbQuestion/cbQuestion.php';
$qid = 0;
@tebajanga
tebajanga / Permission.sh
Last active June 2, 2020 19:56
Adding permission to web folder in Ubuntu
sudo chgrp -R www-data /var/www/html/
sudo find /var/www/html/ -type d -exec chmod g+rx {}
sudo find /var/www/html/ -type d -exec chmod g+rx {} +
sudo find /var/www/html/ -type f -exec chmod g+r {} +
sudo chown -R $USER /var/www/html/
sudo find /var/www/html/ -type d -exec chmod g+s {} +
# Run these commands also, when above commands does not work
sudo usermod -a -G www-data $USER
sudo find /var/www/html/ -type d -exec chmod 775 {} \;