Skip to content

Instantly share code, notes, and snippets.

View turbopixel's full-sized avatar
🚀
What's Up?

Nico turbopixel

🚀
What's Up?
View GitHub Profile

Keybase proof

I hereby claim:

  • I am turbopixel on github.
  • I am turbopixel (https://keybase.io/turbopixel) on keybase.
  • I have a public key whose fingerprint is 9553 AF8A 68B0 ECB0 2671 84D0 90BA 42A3 16C1 C1D2

To claim this, I am signing this object:

@turbopixel
turbopixel / wordpress-file-permission.sh
Last active October 10, 2019 10:58
Webserver File Permission fix
# Let Apache be owner
chown www-data:www-data -R *
# Change directory permissions rwxr-xr-x
find . -type d -exec chmod 755 {} \;
# Change file permissions rw-r--r--
find . -type f -exec chmod 644 {} \;
<?php
function generateRandomID($length = 10) {
$limit_one = rand();
$limit_two = rand();
$randomID = substr(uniqid(sha1(crypt(md5(rand(min($limit_one, $limit_two), max($limit_one, $limit_two)))))), 2, $length);
return $randomID;
}
function gen_uid($l=10){
@turbopixel
turbopixel / jquery-lazy-image-load.js
Created December 2, 2016 16:00
Load images after document-ready. Write image source in "data-src" and call the function lazyLoad('#parent-div");
/**
* Set image data-src="" to src=""
* @author Nico Hemkes <www.hemk.es>
*
* @param parent jQuery selector
*/
function lazyLoad( parent ){
var images = $(parent).find('img');
$.each( images, function( i, img ){
@turbopixel
turbopixel / mysqldumper.sh
Last active September 26, 2016 20:53
MySQL Dump Cronjob
#!/bin/bash
# MySQL Console Dumper
# author: Nico Hemkes <www.nokes.de>
# date: 26.09.2016
# settings
user="USER"
pw="PASSWORD"
backupDir="/media/backup/"
today=$(date +"%m-%d-%Y")
@turbopixel
turbopixel / fix-wordpress-permissions.sh
Created July 14, 2016 20:56 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory