This file contains 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
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^oldnetworkname.com$ [OR] | |
RewriteCond %{HTTP_HOST} ^www.oldnetworkname.com$ | |
RewriteRule (.*)$ http://newname.com/$1 [R=301,L] |
This file contains 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
// turn gravity form labels into placeholder values | |
jQuery('form ul li').each(function(index) { | |
feildid = jQuery(this).attr('id'); | |
feildname = jQuery('#'+feildid+' label').text().replace('*','').replace(':',''); | |
jQuery('#'+feildid+' input, #'+feildid+' textarea').attr('placeholder',feildname); | |
jQuery('#'+feildid+' label').remove() | |
}) |
This file contains 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
$ sudo vi /etc/apache2/users/handsomefox.conf | |
<Directory "/Users/handsomefox/Sites/"> | |
Options Indexes MultiViews | |
Options +Indexes +FollowSymLinks +ExecCGI | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> |
This file contains 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
$ sudo apachectl restart |
This file contains 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
$ top | |
$ 1 | |
$ shift+W |
This file contains 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
$ crontab -e |
This file contains 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
* * * * * top -d 99 -n 1 -b > /var/www/.../top.txt |
This file contains 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
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<script> | |
// reload #dynamic_stats of this page every 30 seconds | |
// this will hold and change the results of top | |
// stored in spans: #source_* | |
// which is read by the gauges outside of #dynamic_stats | |
$(document).ready(function() { | |
setInterval(function() { | |
var url = 'http://.../this_file.php'; | |
$('#dynamic_stats-wrapper').load(url + ' #dynamic_stats'); |
This file contains 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
<div id="dynamic_stats-wrapper"> | |
<!-- Everything below reloads every 60 seconds --> | |
<div id="dynamic_stats"> | |
<? | |
// get the file from the server | |
$stats = file_get_contents('/var/www/.../top.txt'); | |
$cores = 16; | |
// checky amature way to remove extra spacing |
This file contains 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
<? | |
$mysqli = new mysqli('localhost', 'user', 'password', 'database'); | |
$handle = fopen('filename.sql', 'rb'); | |
if ($handle) { | |
while (!feof($handle)) { | |
// This assumes you don't have a row that is > 1MB (5000000) | |
// which is unlikely given the size of your DB | |
// Note that it has a DIRECT effect on your scripts memory | |
$buffer = stream_get_line($handle, 5000000, ";\n"); | |
$mysqli->query($buffer); |