Skip to content

Instantly share code, notes, and snippets.

@vhr
vhr / BoyerMoore.php
Created October 20, 2015 19:26 — forked from nticaric/BoyerMoore.php
Boyer–Moore algorithm implementation in PHP
<?php
/**
* Returns the index of the first occurrence of the
* specified substring. If it's not found return -1.
*
* @param string
* @param string
* @return int
*/
@vhr
vhr / docker-compose.yml
Created April 28, 2017 15:11
Docker compose MySQL and phpMyAdmin containers
version: '2'
services:
mysql:
image: mysql:5
volumes:
- ./mysql:/var/lib/mysql
restart: always
ports:
- "3306:3306"
@vhr
vhr / mkvideo.sh
Created July 9, 2017 16:39 — forked from pklaus/mkvideo.sh
A Bash script to create a video from series of JPEG images. Ideal to create videos from timed sequences shot with a tripod. It uses mogrify (from imagemagick) to resize the images to FullHD and it then uses ffmpeg to create a video from the sequence of images.
#!/bin/bash
# This is a script to create a video from series of JPEG images
# Call it in a folder full of JPEGs that you want to turn into a video.
# Written on 2013-01-08 by Philipp Klaus <philipp.l.klaus →AT→ web.de>.
# Check <https://gist.github.com/4572552> for newer versions.
# Resources
# * http://www.itforeveryone.co.uk/image-to-video.html
# * http://spielwiese.la-evento.com/hokuspokus/index.html
@vhr
vhr / android-studio.desktop
Created October 8, 2017 11:32
Ubuntu application launcher icon for Android Studio
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=/usr/local/android-studio/bin/studio.png
Exec=sh /usr/local/android-studio/bin/studio.sh
Name=Android Studio
@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
@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 / 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 / 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-????????
#!/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
$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) {