Finding the biggest files (Linux)

There are times when you need to find what is taking up the most space on your drives. The following will list the files in the current directory in order of file size.

ls -l | tr -s " " | cut -d" " -f 5,9 --output-delimiter=' ' | sort -k 1 -g

Breakdown:
ls -l >lists all file info, including size.
tr -s " " >removes extra spaces so that each field is delimited by only one space.

Curve Fit Extrapolation for Ebola Outbreak

I've been following the ebola outbreak with interest, especially since hearing a number of competing calm assurances and hysterical predictions of catastrophe. To help understand the threat, I've taken the World Health Organization infection data and calculated the doubling period. Using an exponential model, I calculated a doubling period of 28.2 days, or four weeks. On October 8, the number of infections was 8100. So, on November 5 there will be around 16,200 infections. By Christmas Day there will be 55, 000 cases and January 15 there will be 95,000 cases.

Drupal 7 with NginX, SQLite - Notes

DRUSH:
sudo apt-get install drush
sudo drush dl drush --destination='/usr/share'
# Check Version:
drush --version

NGINX
sudo apt-get install nginx
# See notes for php5-fpm in /usr/share/nginx/sites-available/default
- add index.php to index line under service { listen:80 ....
- uncomment lines to enable php5-fpm
Configuration file: /usr/share/nginx/sites-available/default, don't forget rewrite rules.
See configuration notes at https://gist.github.com/Mulkave/6103129

PHP
sudo apt-get install php5 php-cgi php5-fpm php5-pdo php5-gd

Drupal 7 Migration from MySQL to SQLite - Notes

Use: DBTNG module: https://drupal.org/project/dbtng

Some modules may have to be un-installed. Turn off Clean URLs before migrating.

Restricting Time-sensistive Access Using hook_node_access() and MYSQL Date and Time Functions

In this scenario I needed to prevent a user from creating more than one report per month. This was accomplished by creating a module and using hook_node_access along with MYSQL Date and Time functions.

Example


/**
* Implements hook_node_access()
**/
function sqc_permissions_node_access($node, $op, $account) {

switch ($op) {
case 'create':
// Allow creation of an SQC report only if no report already exists for this month already.
if ($node != 'monthly_user_report') return NODE_ACCESS_IGNORE;
global $user;

How to Clean up your Linux Boot Partition

Here's a handy article containing a script for cleaning up your boot partition, which can cause problems if it fills up with old kernel versions.

http://ubuntugenius.wordpress.com/2011/01/08/ubuntu-cleanup-how-to-remov...

PHP Code for Rendering a Drupal Page with Hidden Fields


<?php
$node_id = 131; // Set your node ID to whatever.
$node = node_load($node_id); // loads the node object for that node.
$my_node = node_view($node, "full"); // converts the node object to an array of elements.
$my_node["field_my_field"]["#access"] = 0; // Turns off access to the offending field so it doesn't display.
print (drupal_render($my_node)); // renders the array.
?>

TightVNC over the Internet using a Reverse SSH Tunnel, PuTTY and a Middleman

Scenario:

Remote Computer - firewall - Internet - middleman server - internet - firewall - local computer

Drupal 7 - Reset Drupal after '5 failed logins'

In Drush, execute:

drush php-eval 'db_query("DELETE FROM `flood`");'

Postfix Tweaks for Sending from Remote Email Clients

Due to protections against spam, sending email from remote clients often requires special tweaks. This post shows how to configure postfix (a very popular mail transfer agent for Linux) to allow for sending mail with remote clients.
Many ISPs block port 25, the default smtp port, in order to make it harder for spam bots to operate. You can enable an alternate port by editing the master.cf file, usually found in /etc/postfix (it's location will depend on how it was installed).
In master.cf find a line similar to the following.

Syndicate content