Skip to content

Instantly share code, notes, and snippets.

@vhr
vhr / gist:c6b191a6288cca6e3a96f2c2e2be0b38
Created December 1, 2023 13:20
Convert JPEGs to PDF
cp /usr/share/ghostscript/9.55.0/lib/viewjpeg.ps ./
gs \
-dNOSAFER \
-sDEVICE=pdfwrite \
-o output.pdf \
viewjpeg.ps \
-c "(page1.jpg) viewJPEG showpage \
(page2.jpg) viewJPEG showpage"
@vhr
vhr / stop-mic-noice.md
Created May 30, 2019 14:28
[Ubuntu] Adding a microphone background noise filter
@vhr
vhr / php
Created November 4, 2018 15:16
Use docker container for local CLI PHP
#!/bin/bash
docker run --rm -v $(pwd):/app -w /app php:cli php $@
@vhr
vhr / setup-time.sh
Created October 16, 2018 04:34
Set EET in CentOS7
#!/bin/bash
yum install -y ntp
chkconfig ntpd on
ntpdate pool.ntp.org
service ntpd start
timedatectl set-timezone Europe/Sofia
$dependencyInjector['centreon_remote.export']->export((new \CentreonRemote\Infrastructure\Export\ExportCommitment(3, [1,3])));
exit;
echo "SENDEXPORTFILE:1" > /var/lib/centreon/centcore.cmd
/usr/share/perl5/vendor_perl/centreon/script/centcore.pm
sendExportFile
unless ( -e $self->{centreonDir} . "filesGeneration/export/".$id) {
#!/bin/bash
cd /tmp && wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
cd /tmp && tar -xzf ioncube_loaders_lin_x86-64.tar.gz
phpver=`php -v | awk '{print $2}' | grep 7 | cut -c1-3`
extdir=`php -i | grep extension_dir | awk '{print $3}' | grep php`
mv /tmp/ioncube/ioncube_loader_lin_$phpver.so $extdir/
echo zend_extension = $extdir/ioncube_loader_lin_$phpver.so >> `php -i | grep ini | awk '{print $5}' | grep php.ini`
systemctl restart php72-php-fpm
systemctl restart httpd
php -v
@vhr
vhr / vm-cleanup.sh
Created September 3, 2018 14:41
Bash script for cleanup of Centreon central virtual machine
#!/bin/bash
#
# Clean up dev VM
#
rm -f /root/VBoxGuestAdditions_*
rm -f /var/log/boot.log-????????
rm -f /var/log/btmp-????????
rm -f /var/log/cron-????????
rm -f /var/log/maillog-????????
@vhr
vhr / Centreon.postman_collection.json
Created June 8, 2018 05:41
Centreon CLAPI requests for Postman
{
"info": {
"_postman_id": "f5e3af2f-37e7-42fe-898a-ed02b60a9614",
"name": "Centreon",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Auth",
"description": "",
@vhr
vhr / install-composer.sh
Created May 4, 2018 11:58
Install composer
wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet
sudo mv ./composer.phar /usr/local/bin/composer
@vhr
vhr / migrate-to-php72.sh
Last active January 18, 2019 12:22
Bash script for migration to PHP v7.2
#!/bin/bash
#######################################################
# Install PHP 7.2 on CentOS 7 https://www.cyberciti.biz/faq/how-to-install-php-7-2-on-centos-7-rhel-7/
# PHP Roadmap http://php.net/supported-versions.php
#######################################################
# Add PHP 7.2 repo
yum -y install wget
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm