Skip to content

Instantly share code, notes, and snippets.

View orlissenberg's full-sized avatar

Onno Lissenberg orlissenberg

View GitHub Profile
@orlissenberg
orlissenberg / gist:7125064
Created October 23, 2013 19:28
Configure Kaleidoscope as the GIT difftool on the terminal.
------------------------------------
.git/config
------------------------------------
[diff]
tool = ksdiff
[difftool "ksdiff"]
cmd = ksdiff \"$LOCAL\" \"$REMOTE\"
------------------------------------
@orlissenberg
orlissenberg / fetch_ip.sh
Last active August 29, 2015 14:10
Fetch IPv4 address from ifconfig with awk shell script.
#!/bin/sh
# Examples:
# ./fetch_ip.sh "" docker
# ./fetch_ip.sh "" lo
# ./fetch_ip.sh 192.168
# ./fetch_ip.sh 192.168 eth1
ifconfig | awk '{
if ($0 ~ /Link encap:/ && $0 ~ /'$2'/) {
@orlissenberg
orlissenberg / gist:cd92b94a71737224a283
Created April 16, 2015 10:30
List of Parser Tokens Values on the CLI.
//
// http://php.net/manual/en/tokens.php
//
// WARNING: This means that the concrete value of a token may change between two PHP versions. For example the T_FILE constant is 365 in
// PHP 5.3, while the same value refers now to T_TRAIT in PHP 5.4 and the value of T_FILE is 369.
//
-> php -r 'for ($i=200; $i<500; $i++){ if (token_name($i) !== "UNKNOWN") { echo $i . " " . token_name($i) . "\n"; } };'
@orlissenberg
orlissenberg / create-typo3-extension.sh
Last active August 29, 2015 14:24
Create a TYPO3 extension directory structure.
#!/usr/bin/env bash
# TYPO3 - Extension directory structure
# http://docs.typo3.org/typo3cms/CodingGuidelinesReference/FileSystemConventions/ExtensionDirectoryStructure/Index.html
# This directory structure is strongly recommended. Extensions may create their own directories (for example, move all
# language files into other directories).
# execute from: typo3conf/ext
if [ $# -eq 0 ]
@orlissenberg
orlissenberg / php5.6_soap_example.php
Created July 10, 2015 11:09
SOAP / PHP 5.6.7 (Zend Server 8) stream context TLS - Failed to load external entity.
<?php
// http://php.net/manual/en/migration56.openssl.php
if (version_compare(phpversion(), '5.6', '>='))
{
$wsdl = 'https:// ...'
$opts = array(
'ssl' => array(
@orlissenberg
orlissenberg / ansible_notes.yml
Last active August 29, 2015 14:26
Ansible tricks.
---
# http://docs.ansible.com/ansible/playbooks_conditionals.html
- name: Get platform specific variables.
include_vars: "{{ansible_os_family}}.yml"
when: ansible_os_family == "Debian" or ansible_os_family == "RedHat"
# Ansible 1.9 introduced the new becomes syntax
# http://stackoverflow.com/questions/21344777/how-to-switch-a-user-per-task-or-set-of-tasks
- name: checkout repo
@orlissenberg
orlissenberg / rsync_local.sh
Created August 3, 2015 07:34
Continuous rsync.
#!/usr/bin/env bash
# https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps
while true ; do
rsync -aP /vagrant/projects/a-project/ /srv/www//a-project
sleep 2 # seconds
done
@orlissenberg
orlissenberg / redeploy_nginx_config.sh
Created August 3, 2015 07:43
Nginx configuration script.
#!/usr/bin/env bash
sudo rm /etc/nginx/sites-enabled/example.conf
sudo cp /vagrant/projects/a-project/nginx/example.conf /etc/nginx/sites-available/example.conf
sudo ln -s /etc/nginx/sites-available/example.conf /etc/nginx/sites-enabled/example.conf
# http://wiki.nginx.org/CommandLine
# /usr/bin/nginx -t
@orlissenberg
orlissenberg / example-nginx.conf
Last active August 29, 2015 14:26
Nginx PHP configuration example.
# http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
# http://laravel-recipes.com/recipes/26/creating-a-nginx-virtualhost
server {
listen 80;
server_name www.sitename.dev sitename.dev;
charset utf-8;
access_log /var/log/nginx/sitename.access.log;
error_log /var/log/nginx/sitename.error.log;
@orlissenberg
orlissenberg / oracle_instant_client_php7.md
Created January 15, 2016 17:36
Install the Oracle instant client via pecl on jessie for PHP 7

#Oracle Database Instant Client Installation

Download

cd /opt
sudo unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip
sudo unzip instantclient-basic-linux.x64-12.1.0.2.0.zip

cd /opt/instantclient_12_1

sudo ln -s libclntsh.so.12.1 libclntsh.so