Skip to content

Instantly share code, notes, and snippets.

mloberg / watermark.html
Created June 23, 2011 18:40
Watermark PHP
View watermark.html
<img src="watermark.php?watermark=watermark.png&src=test.jpg" />
miguelramos / PHP-ELEMENT-Search.php
Created March 6, 2012 23:31
PHP: Search element in array recursive
View PHP-ELEMENT-Search.php
* Function to search for key/value in recursive mode. If last arg is true
* it returns it's value or key. By default give true or false if key/value have been found.
* @param array $array Array to search
* @param string $search What to search
* @param string $mode Mode search for value or key
* @param boolean $return Return value or key
nghuuphuoc / 1) Install
Last active September 4, 2023 09:29
Install Redis on Centos 6
View 1) Install
// --- Compiling ---
$ wget
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh
$ rpm -Uvh
denji /
Last active February 17, 2024 16:49
NGINX tuning for best performance

Moved to git repository:

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

elena-kolevska / validators.php
Last active June 24, 2021 14:44
Custom alphabetic validator that allows spaces
View validators.php
/* app/validators.php */
Validator::extend('alpha_spaces', function($attribute, $value)
return preg_match('/^[\pL\s]+$/u', $value);
bocharsky-bw / hgfs-shared-folder-permissions
Created July 5, 2014 11:00
Permissions on Shared Folders on Ubuntu
View hgfs-shared-folder-permissions
VMware Fusion - Permissions on Shared Folders on Ubuntu
VMware Fusion provides a nice functionality of sharing folder from host (Mac OSX) to guest (Ubuntu). But then, it seems they are more focused on windows guests, because they screwup on file permissions of shared folders.
"ls -al /mnt/hgfs" will show 501 dialout as user and group, which is sure to cause permission issues on linux guest.
Update: Found a more persistent alternative
1. sudo vim /etc/vmware-tools/
2. Search for 'vmhgfs_mnt="/mnt/hgfs"'. After this line add: 'vmuser=${VMWARE_MNT_USER:-root}'
jacobtwlee / UploadSupportDetection.js
Last active July 16, 2019 13:59
Upload support detection
View UploadSupportDetection.js
function isUploadSupported() {
if (navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)) {
return false;
var elem = document.createElement('input');
elem.type = 'file';
return !elem.disabled;
Kryptonit3-zz / .gitignore
Last active July 13, 2018 18:15
Lightweight image cropping with jQuery
View .gitignore
# Ignore everything in this directory
# Except this file
jashmenn /
Last active September 6, 2022 23:11
Javascript var self = this; vs. .bind

The Problem

In Javascript this is bound in unexpected ways. Functions, in particular, create a new 'this' and so when you want to keep a reference to an "outer" object you sometimes see the pattern:

var self = this;

as in:

var self = this;
taotao /
Last active January 13, 2021 12:50
Debian Exim4 mail server with Clamav support.


  • Debian: Jessie
  • Mail Server: Exim
  • Anti-Virus: Clamav

Install packages

  1. apt-get install clamav clamav-daemon exim4-daemon-heavy

Configuration of Clamav

  1. Modify /etc/clamav/clamd.conf