This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Copyright (c) 2013, Armond B. Carroll III, [email protected] | |
* This 'gist' (file) is distributed under the BSD 2-Clause License. | |
* | |
* This code will turn a function list into the inside part of a class, with | |
* the synopsis, and each member calling the original procedural style function. | |
* It was written to turn ncurses_* functions into a class. | |
* | |
* TO USE, load a text file into a file (ncurses.txt in this revision), with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Load predis object into $redis | |
here */ | |
$out_file = 'REDIS-DUMP.txt'; | |
$fp = fopen($out_file, 'w+'); | |
echo "Starting... \n"; | |
echo "KEYS... "; | |
$objects = $redis->keys("*"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array functions: | |
array_search $needle, $haystack | |
in_array $needle, $haystack | |
String functions: | |
strchr $haystack, $needle | |
stripos $haystack, $needle | |
stristr $haystack, $needle | |
strpos $haystack, $needle | |
strrchr $haystack, $needle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Expiration and compression | |
# This will generally improve gtmetrix (yslow/page speed) score at no expense. | |
ExpiresActive On | |
ExpiresByType image/x-icon "access plus 6 weeks" | |
ExpiresByType image/png "access plus 6 weeks" | |
ExpiresByType image/jpg "access plus 6 weeks" | |
ExpiresByType image/gif "access plus 6 weeks" | |
ExpiresByType image/jpeg "access plus 6 weeks" | |
ExpiresByType application/x-shockwave-flash "access 6 weeks" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A.B. Carroll [email protected] | |
# File location in my setup: | |
# /media/zebra/launch-zebra-backup | |
# chmod +x /media/launch-zebra-backup | |
date > /media/zebra/last-backup.start | |
date >> /media/zebra/all-backup.start | |
rsync -avh --delete --progress /svn-migrate /media/zebra/ | |
rsync -avh --delete --progress --exclude=/apps/php_errors.log /apps /media/zebra/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Pops open a new window given the identifier (name), url, width, height, and | |
optional additional options (as normally passed to window.open()), centered | |
on the screen. Additionally, it will not open more than one instance of each | |
identifier. | |
Amalgamation of: | |
https://developer.mozilla.org/en-US/docs/Web/API/Window.open "Best Practices" | |
http://stackoverflow.com/questions/4068373/center-a-popup-window-on-screen | |
"Single/Dual Monitor Function" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This clears the LESS.js cache, since it aggressively caches @import statements. | |
* Credit: Attaboy, https://gist.github.com/attaboy/1346280 | |
* Additional key checks and debugging output by A.B. Carroll. (http://github.com/nezzario) | |
* License: Assumed MIT/BSD-like license, please give credit where credit is due. | |
*/ | |
less.env = 'development'; | |
console.log("If you are seeing this in a production environment you are likely doing something wrong or forgot to remove the destroyLessCache() script."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* A.B. Carroll, public domain */ | |
function str_distance_array($needle, $haystack) { | |
$confidence_map = []; | |
foreach ($haystack as $h) { | |
if(strlen($needle) < strlen($h)) { | |
$normalize = strlen($needle); | |
} else { | |
$normalize = strlen($h); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
packages=( | |
# > > System utilities | |
netselect-apt sudo rcconf parted | |
# > > Internet Services, Programming | |
nginx | |
php5-fpm php5-cli | |
mysql-server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Beginnger | |
sudo apt-get install vim netselect-apt | |
# Basics | |
sudo apache2-utils autossh bc beep btrfs-tools cryptsetup curl dnsutils dos2unix e2fsprogs file ftp git hexedit hfsprogs htop iftop iotop iptraf less links lrzsz lvm2 md5deep mercurial nmap ntp parted patch pax putty-tools pv rsync screen sudo sysstat tmux tree vim wget whois xz-utils | |
# Paritioning, File System & FS Encryption | |
sudo apt-get install lvm2 cryptsetup e2fsprogs hfsprogs btrfs-tools | |
# Monitoring |
OlderNewer