Skip to content

Instantly share code, notes, and snippets.

View webolizzer's full-sized avatar

webolizzer

  • Germany
View GitHub Profile
@webolizzer
webolizzer / gist:30f78d5650048690b63a3787ac033788
Created October 18, 2016 17:56
simple PHP wrapper around wkhtmltopdf
<?php
/**
* @version 0.1
* @author github.com/webolizzer
* If you find it useful, you can buy me a coffee and a Kit-Kat @ paypal.me/webolizzer
* Thank you! :)
*/
class pdfGenerator {
@webolizzer
webolizzer / onchange.sh
Created February 9, 2017 15:17 — forked from senko/onchange.sh
Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <[email protected]>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@webolizzer
webolizzer / prevent-zooming-cross-browser-with-jquery.js
Last active March 10, 2017 13:55
prevent zooming cross-browser with jquery
// prevent zooming cross-browser with jquery
// @author http://stackoverflow.com/a/31131948/2337281
$(document).keydown(function(event) {
if (event.ctrlKey === true && (event.which == '61' || event.which == '107' || event.which == '173' || event.which == '109' || event.which == '187' || event.which == '189' ) ) {
//alert('disabling zooming k');
event.preventDefault();
// 107 Num Key +
// 109 Num Key -
// 173 Min Key hyphen/underscor Hey
@webolizzer
webolizzer / size of the screen current web page and browser window
Last active March 11, 2017 15:14
Get the size of the screen, current web page and browser window
// @author http://stackoverflow.com/a/3437825/2337281
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document (same as pageHeight in screenshot)
$(window).width(); // returns width of browser viewport
$(document).width(); // returns width of HTML document (same as pageWidth in screenshot)
@webolizzer
webolizzer / lzw_encoder.js
Created March 17, 2017 21:21 — forked from revolunet/lzw_encoder.js
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];
@webolizzer
webolizzer / remove elements from array.js
Last active March 28, 2017 10:56
How to iterate over an array and remove elements in JavaScript
var elements = [1, 5, 5, 3, 5, 2, 4];
for(var i = 0; i < elements.length; i++) {
if (elements[i] == 5) {
// delete item from array & decrement i
elements.splice(i--, 1);
}
}
@webolizzer
webolizzer / gist:e46df4ba49dfb146384380db8eecb01f
Created March 30, 2017 16:55 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@webolizzer
webolizzer / sysctl.conf
Created April 8, 2017 12:25 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2

Following instructions at https://mariadb.com/kb/en/mariadb/preparing-for-columnstore-installation/ (There's also https://mariadb.com/kb/en/mariadb/installing-mariadb-deb-files/, but I didn't follow that one.)

Install

sudo apt-get -y install libboost-all-dev expect perl openssl file sudo libdbi-perl libreadline-dev libdbd-mysql-perl
cd ~
wget http://downloads.mariadb.com/MariaDB/mariadb-10.1.22/repo/ubuntu/mariadb-10.1.22-ubuntu-trusty-amd64-debs.tar
cd /opt
sudo tar -xf ~/mariadb-columnstore-tars/mariadb-10.1.22-ubuntu-trusty-amd64-debs.tar
sudo ./mariadb-10.1.22-ubuntu-trusty-amd64-debs/setup_repository
@webolizzer
webolizzer / Install MariaDB 10.2.6 on Ubuntu 16.04 xenial.md
Last active May 27, 2017 12:52
Install MariaDB 10.2.6 on Ubuntu 16.04 xenial
/**
* @author github.com/webolizzer
* You can buy me a coffee and a Kit-Kat @ paypal.me/webolizzer
* Thank you! :)
*/

// backup old DB

$ cp -a /var/lib/mysql/ /var/lib/mysql.bak