Skip to content

Instantly share code, notes, and snippets.

@alipek
alipek / php-apcu-bc_on_ubuntu_16.04.md
Created September 30, 2017 09:34 — forked from philbot9/php-apcu-bc_on_ubuntu_16.04.md
Install php-acpu-bc on Ubuntu 16.04

The php-apcu-bc package provides a backwards compatibility layer from apcu -> apc, and is reuqired for some older PHP code bases (e.g. Yii 1). The package is not (yet) available in the Ubuntu 16.04 repos. To install it, use php-pear:

sudo apt-get install php-dev php-pear
sudo pecl install apcu_bc-beta

Then edit /etc/php/7.0/apache2/php.ini and add the following at the end of the file:

<?php
namespace AppBundle\Tool;
use RecursiveIterator;
class VariablesRecursiveIterator implements \RecursiveIterator
{
private static $objects = [];
@alipek
alipek / docker-cleanup-resources.md
Created November 19, 2017 08:27 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@alipek
alipek / rabbit.js
Created June 1, 2018 08:16 — forked from tareqabedrabbo/rabbit.js
Connects to RabbitMQ's log exchange and logs all received messages to the console
var connection = require('amqp').createConnection({host: 'localhost'});
connection.on('ready', function() {
// create a temporary queue by passing an empty string as the queue name
var queue = connection.queue('', function(queue) {
console.log('connected to ' + queue.name);
// bind the queue to all messages on the amq.rabbitmq.log topic exchange
queue.bind('amq.rabbitmq.log', '#');
@alipek
alipek / docker-image-size.sh
Created August 10, 2018 10:15 — forked from andyrbell/docker-image-size.sh
Sort docker images by size desc
#!/bin/sh
docker images --format '{{.Size}}\t{{.Repository}}:{{.Tag}}\t{{.ID}}' | sort -h | column -t
<?php
echo is_resource(@fsockopen("localhost", "5672"))?"ok\n":"fail\n";

Delete all queue

rabbitmqctl list_queues | grep -v Listing | awk '{print $1}' | xargs -I '{}' rabbitmqadmin --user=$RABBITMQ_DEFAULT_USER --password=$RABBITMQ_DEFAULT_PASS delete queue 'name={}'

@alipek
alipek / clean-up-boot-partition-ubuntu.md
Created January 22, 2019 11:59 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@alipek
alipek / rotate_desktop.sh
Created May 20, 2019 13:18 — forked from mildmojo/rotate_desktop.sh
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
@alipek
alipek / getcomposer.sh
Created April 28, 2020 11:20 — forked from justb81/getcomposer.sh
get composer programmatically
#!/bin/sh
EXPECTED_SIGNATURE=$(curl -sS https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php