Skip to content

Instantly share code, notes, and snippets.

View shaigluskin's full-sized avatar

Shai Gluskin shaigluskin

  • sgluskin.art
  • Philadelphia
View GitHub Profile
# Custom history configuration
# Run script using:
# chmod u+x better_history.sh
# sudo su
# ./better_history.sh
echo ">>> Starting"
echo ">>> Loading configuration into /etc/bash.bashrc"
echo "HISTTIMEFORMAT='%F %T '" >> /etc/bash.bashrc
echo 'HISTFILESIZE=-1' >> /etc/bash.bashrc
@isholgueras
isholgueras / add_file_to_node_D7.php
Created July 30, 2012 09:04
Add files tod node programatically in Drupal 7
<?php
$existing_filepath = "/home/nzcodarnoc/sites/default/files/imported/picture.jpg"
$new_filepath = "public://picture.jpg"
// Load a node
$node = node_load($nid, NULL, TRUE);
// Create the file object
$drupal_file = file_save_data(file_get_contents($existing_filepath), $new_filepath);
$drupal_file->alt = $node->title;
$drupal_file->title = $node->title;
// Assign the file object to the node, as an array