Quickly install a new Drupal site (in a multisite environment) using Drush

Easy as that! Just replace with your own parameters!

drush site-install standard \
--site-name=FoobarSite \
--sites-subdir=foobar \
--db-su=adminuser \
--db-su-pw=adminuserpw \
--db-url=mysql://foobar:foobarpassword@localhost/foobar
――

How to add a Password reset link on user login block in Drupal

In Drupal 7, adding a link to allow users to reset their password (a "forgot my password" link) is quite easy through the hook_form_alter() hook.

/**
 * implements hook_form_alter().
 */
function mythemename_form_alter(&$form, &$form_state, $form_id)
{
  switch($form_id)
  {
    case 'user_login':
    case 'user_login_block':
      $form['links'] = array(
        array('#markup' => '<a href="/user/password/">Forgot your password?</a>'),
        '#weight' => 100,
      );
      break;
  }
}
――

Temperature Display with DHT22, VirtualWire and a LCD Shield on an Arduino Uno

The code below displays the temperature and humidity from a DHT22, but also receives that same data from another arduino or atmega through an RF Link using VirtualWire and displays it as well.

VirtualWire can be downloaded from:
airspayce.com/mikem/arduino/VirtualWire/index.html
DHT22 Library from Adafruit: github.com/adafruit/DHT-sensor-library
LCD Library and DFR Key from Linksprite: Linksprite Wiki

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
 
#include "DHT.h"
#include <LiquidCrystal.h>
#include "DFR_Key.h"
#include <VirtualWire.h>
 
// PIN 11 = RX
#define DHTPIN 12     // what pin we're connected to
#define LCD_BACKLIGHT_PIN         10  // D10 controls LCD backlight
//some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like
#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH )
#define LCD_BACKLIGHT(state)    { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }
 
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11 
#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)
 
 
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );
DFR_Key keypad;
 
DHT dht(DHTPIN, DHTTYPE);
 
int localKey = 0;
boolean displaycelsius = false;
boolean isstart = true;
boolean backlight = true;
boolean displayold = false;
float oldt = 0;
float oldh = 0;
float mint = 0;
float minh = 0;
float maxt = 0;
float maxh = 0;
float remt = 0;
float remh = 0;
float rempI = 0;
float rempM = 0;
float remt2 = 0;
 
float oldcelsius = false;
unsigned long previousMillis = 0;
long interval = 5000;
float h = 0;
float t = 0;
int displaymode = 4;
 
byte smiley[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b10001,
  0b01110,
  0b00000
};
 
byte frownie[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b00000,
  0b01110,
  0b10001
};
 
 
void setup() {
  Serial.begin(9600);
 
  // set up Receiver (first because it may set unused pins to wrong mode)
  vw_setup(2000);	 // Bits per sec
  vw_rx_start();       // Start the receiver PLL running
 
 
  // set up LCD  
  lcd.begin(16, 2);
  //Serial.println("DHTxx test!");
  lcd.print("Getting Temp!");
  dht.begin();
  keypad.setRate(10);
 
  digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)
  pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output
 
  // create a new character
  lcd.createChar(1, smiley);
  // create a new character
  lcd.createChar(2, frownie);
 
  LCD_BACKLIGHT(backlight);
 
 
}
 
void loop() {
 
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
 
 
  localKey = keypad.getKey();
  if (localKey == LEFT_KEY)
  {
    lcd.clear();
    displaymode = (displaymode + 1) % 6;
  }
  if (localKey == UP_KEY)
  {
    lcd.clear();
    //displayold = !displayold;
  }
  if (localKey == RIGHT_KEY)
  {
    backlight = !backlight;
    LCD_BACKLIGHT(backlight);
  }
 
  unsigned long currentMillis = millis();
 
  if(isstart || (currentMillis - previousMillis > interval)) {
    previousMillis = currentMillis;   
 
    // Reading temperature or humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
    h = dht.readHumidity();
    t = dht.readTemperature(!displaycelsius);
    /*LCD_BACKLIGHT_OFF();
    delay(200);
    LCD_BACKLIGHT_ON();*/
  }
 
  if(isstart || localKey == SELECT_KEY)
  {
    isstart = false;
    oldh = h;
    oldt = t;
    minh = h;
    mint = t;
    maxh = h;
    maxt = t;
    if(backlight)
    {
      LCD_BACKLIGHT_OFF();
      delay(200);
      LCD_BACKLIGHT_ON();
    }
  }
 
  minh = min(minh, h);
  mint = min(mint, t);
  maxh = max(maxh, h);
  maxt = max(maxt, t);
 
  lcd.setCursor( 0, 0 );
  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) {
    //Serial.println("Failed to read from DHT");
    lcd.print("Sensor Error       ");
    lcd.setCursor( 0, 1 );
    lcd.print("                ");
  } else {
    if(displaymode == 0)
    {
      lcd.setCursor( 0, 0 );
      lcd.print("Temp.:  ");
      lcd.print(t,1);// Serial.print(t);
      lcd.print("F ");
      if((int)t>=68)
        lcd.write(1);
      else
        lcd.write(2);
 
      lcd.setCursor( 0, 1 );
      lcd.print("Humid.: ");
      lcd.print(h,1);// Serial.print(h);
      lcd.print("%");// Serial.print(" %\t");
    }
 
    if(displaymode == 1) // show saved temps
    {
      lcd.setCursor( 0, 0 );
      lcd.print("T: ");
      lcd.print(t,1);// Serial.print(t);
      lcd.print("F (");
      lcd.print(oldt,1);// Serial.print(h);
      lcd.print("F)");// Serial.print(" %\t");
 
      lcd.setCursor( 0, 1 );
      lcd.print("H: ");
      lcd.print(h,1);// Serial.print(h);
      lcd.print("% (");
      lcd.print(oldh,1);// Serial.print(h);
      lcd.print("%)");// Serial.print(" %\t");    
    }
 
    if(displaymode == 2) // show min/max temps
    {
      lcd.setCursor( 0, 0 );
      lcd.print("Max T: ");
      lcd.print(maxt,1);// Serial.print(t);
      lcd.print("F");
 
      lcd.setCursor( 0, 1 );
      lcd.print("Min T: ");
      lcd.print(mint,1);// Serial.print(t);
      lcd.print("F");
    }
 
    if(displaymode == 3) // show min/max humid
    {
      lcd.setCursor( 0, 0 );
      lcd.print("Max H: ");
      lcd.print(maxh,1);// Serial.print(h);
      lcd.print("%");
 
      lcd.setCursor( 0, 1 );
      lcd.print("Min H: ");
      lcd.print(minh,1);// Serial.print(h);
      lcd.print("%");
    }
 
    if(displaymode == 4) // show local and remote
    {
      lcd.setCursor( 0, 0 );
      lcd.print("LT:");
      lcd.print(t,1);// Serial.print(t);
      lcd.print(" LH:");
      lcd.print(h,1);// Serial.print(h);
      //lcd.print("F");// Serial.print(" %\t");
 
      lcd.setCursor( 0, 1 );
      lcd.print("RT:");
      lcd.print(remt,1);// Serial.print(h);
      lcd.print(" RH:");
      lcd.print(remh,1);// Serial.print(h);
      //lcd.print("");// Serial.print(" %\t");    
    }
 
    if(displaymode == 5) // show Remote
    {
      lcd.setCursor( 0, 0 );
      lcd.print("P:");
      lcd.print(rempI,1);// Serial.print(t);
      lcd.print("in ");
      lcd.print(rempM,1);// Serial.print(h);
      lcd.print("m");
      //lcd.print("F");// Serial.print(" %\t");
 
      lcd.setCursor( 0, 1 );
      lcd.print("T: ");
      lcd.print(remt,1);// Serial.print(h);
      lcd.print(" (");
      lcd.print(remt2,1);// Serial.print(h);
      lcd.print(")");
      //lcd.print("");// Serial.print(" %\t");    
    }
 
    /*if(!animfirst || localKey == SELECT_KEY)
    {
      animfirst = true;
      for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
        // scroll one position left:
        lcd.scrollDisplayRight(); 
        // wait a bit:
        //delay(150);
      }
 
      // scroll 29 positions (string length + display length) to the right
      // to move it offscreen right:
      for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
        // scroll one position right:
        lcd.scrollDisplayLeft(); 
        // wait a bit:
        delay(50);
      }
    }*/
 
 
  }
 
 
    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
	int i;
 
        digitalWrite(13, true); // Flash a light to show received good message
	// Message with a good checksum received, dump it.
	Serial.print("Got: ");
 
	for (i = 0; i < buflen; i++)
	{
	    Serial.print(buf[i], DEC);
	    Serial.print(" ");
	}
	Serial.println("");
        digitalWrite(13, false);
 
        if(buf[0] == 200)
        {
          remh = (float) buf[1] + ((float) buf[2]) / 100.0;
          remt = (float) buf[3] + ((float) buf[4]) / 100.0;
          rempI = (float) buf[6] + ((float) buf[7]) / 100.0;
          rempM = 100.0 * (float) buf[8] + (float) buf[9] + ((float) buf[10]) / 100.0;
          remt2 = (float) buf[11] + ((float) buf[12]) / 100.0;
        }
    }
 
  if(localKey != SAMPLE_WAIT)
    delay(200); // delay to avoid key getting registered multiple times.
}
――

How to install a rtl8192cu on the Beaglebone Black (BBB) running Angstrom

opkg update
opkg upgrade
opkg install kernel-dev
opkg install kernel-headers

You may need to reboot.

cd /usr/src/kernel
make scripts
ln -s /usr/src/kernel /lib/modules/$(uname -r)/build
cd ~
git clone git://github.com/cmicali/rtl8192cu_beaglebone.git
cd rtl8192cu_beaglebone
make CROSS_COMPILE=""

Then follow 2.2 from bonenotes.tumblr.com:

Install the driver

mv 8192cu.ko /lib/modules/$(uname -r)
depmod -a
cd /etc/modules-load.d
echo "8192cu" > rtl8192cu-vendor.conf

Blacklist the old rtlwifi drivers

cd /etc/modprobe.d
echo "install rtl8192cu /bin/false" >wifi_blacklist.conf
echo "install rtl8192c_common /bin/false" >>wifi_blacklist.conf
echo "install rtlwifi /bin/false" >>wifi_blacklist.conf

Edit /var/lib/connman/settings and enable WIFI

[global]
OfflineMode=false
 
[Wired]
Enable=true
Tethering=false
 
[WiFi]
Enable=true
Tethering=false

Encrypt your passphrase

wpa_passphrase YourSSID YourPassphrase

Edit /var/lib/connman/wifi.config and set it to the following

[service_home]
Type=wifi
Name=YourSSID
Passphrase=YourEncryptedPassphrase

Plug in your WIFI adaptor and reboot

shutdown -r 0

Sources & Thanks:
Big Thanks to cmicali: bonenotes.tumblr.com/
Thanks to Nomel: nomel.org/post/30357133735/beaglebone-tutorial-how-to-compile-kernel-modules-and

――