Skip to content

Instantly share code, notes, and snippets.

View lennartvdd's full-sized avatar

Lennart van den Dool lennartvdd

  • Circular IT Group, DigitalDeploy
  • Utrecht
View GitHub Profile
@lennartvdd
lennartvdd / mock-process.sh
Created August 9, 2015 21:45
Simple Linux Mock process
#!/bin/bash
charlist=( "|" "/" "-" "\\" )
i=0
while [ TRUE ]
do
echo -en "Running mock process. Press CTRL+C to exit. ${charlist[i]} \r"
sleep 0.1
((i++))
if [ $i -gt 3 ]
@lennartvdd
lennartvdd / transip-dyndns.php
Last active August 29, 2015 14:25
TransIP API DynDNS
<?php
// --- Settings
$login = '';
$domainName = '';
$subDomain = '@';
$keyFile = 'transip.key';
$publicIpApi = 'https://api.ipify.org';
@lennartvdd
lennartvdd / install_newrelic_server.sh
Created June 10, 2015 09:01
Install NewRelic Server
#!/bin/sh
echo "This script will install NewRelic Server Monitoring"
read -p "License Key:" NEWRELIC_LICENSE_KEY
echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list
wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -
apt-get update
apt-get install newrelic-sysmond
@lennartvdd
lennartvdd / ubuntu-mysql-installer.sh
Created May 22, 2015 08:17
Ubuntu MySQL Server installer
#!/bin/bash
#
# This script performs the following tasks:
#
# - Update APT repositories
# - Install mysql-server
# - Change MySQL config:
# - listen on internal IP address instead of localhost only for external communication
# - TODO: update MySQL config to update performance
# - Create a MySQL user & database
@lennartvdd
lennartvdd / ubuntu-lemp-yii1-installer.sh
Last active January 16, 2018 06:04
Ubuntu LEMP installer (Yii 1.x)
#!/bin/bash
# This script does the following things
# - update apt respositories
# - Install:
# - nginx
# - memcaced
# - php5-fpm
# - php5-mysql
# - php5-curl
@lennartvdd
lennartvdd / yii-1.x-javascript.php
Created April 28, 2015 10:42
How to use Javascript from a Yii 1.x view file.
<?php
//option 1: via asset (NOTE: Create file: ./assets/form.js relative to view file)
$url = Yii::app()->assetManager->publish(__DIR__.'/assets/form.js');
Yii::app()->clientScript->registerScriptFile($url);
//option 2: via php in view file
$script = <<<EOT
alert('hello world');
EOT;
@lennartvdd
lennartvdd / codeship-test-yii2-advanced.sh
Last active September 8, 2016 22:34
CodeShip - Yii 2.x (Advanced Template) test setup script
# Set php version through phpenv. 5.3, 5.4 and 5.5 available
phpenv local 5.4
# == install pecl extensions
yes yes | pecl install imagick
# == prepare composer
composer config -g github-oauth.github.com "$GITHUB_ACCESS_TOKEN" #make sure this env var is configured in your project settings. otherwise remove this line.
# update phpunit
composer global remove "phpunit/phpunit" --update-with-dependencies
@lennartvdd
lennartvdd / codeship-test-yii1.sh
Last active August 29, 2015 14:17
CodeShip - Yii 1.x test setup script
# Set php version through phpenv. 5.3, 5.4 and 5.5 available
phpenv local 5.4
# == configure composer
composer config -g github-oauth.github.com $GITHUB_ACCESS_TOKEN # configure env var in project settings!
# == install composer global dependencies
composer global require "phpunit/phpunit=4.3.*"
composer global require "phpunit/phpunit-selenium"
composer global require "phpunit/php-invoker"
@lennartvdd
lennartvdd / rsync-backup.sh
Last active August 29, 2015 14:13
rsync backup over ssh
#!/bin/sh
# This script does backups to a remote server over ssh. the account running this script
# must have ssh access to the remote server using passwordless key authentication.
# perform:
# > ssh-keygen -q
# > ssh-copy-id [username]@[hostname]
# test with: `ssh [username]@[hostname]` & add script to cron
# > crontab -e
# #backup: every day @ 03:30 & log output.
@lennartvdd
lennartvdd / schema.org.html
Created November 17, 2014 14:49
implement schema.org aggregate rating
<span itemprop="review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
<span itemprop="rating" style="display:none;">4</span>
<span itemprop="count" style="display:none;">1</span>
</span>
<!-- SHOULD BECOME -->
<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue" style="display:none;">4</span>
<span itemprop="reviewCount" style="display:none;">1</span>