I want to append the string “BYE” to the file test.txt
echo “BYE” >> test.txt
Now, I want to prepend the string “HI” to the file test.txt
echo "HI"|cat - test.txt > /tmp/out && mv /tmp/out test.txt
I want to append the string “BYE” to the file test.txt
echo “BYE” >> test.txt
Now, I want to prepend the string “HI” to the file test.txt
echo "HI"|cat - test.txt > /tmp/out && mv /tmp/out test.txt
http://www.pinvoke.com/
http://www.famfamfam.com/lab/icons/silk/
function POSTReqeustWithHTTPRequest($message, $username, $password)
{
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($username.':'.$password)).
"Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query(array('status' => $message)),
'timeout' => 5,
),
));
$ret = file_get_contents('http://example.com/update.xml', false, $context);
return $ret;
}
This is a very easy installation that lacks in security. That means do it on your personal laptop, no other users but you.
That’s it. You are ready to import the initial files and then commit/update everything you want.
Jason Fried talks about momentum, why roadmaps, specifications and projections are evil, and many other topics.
This article describes the differences between a Linux VPS and a Linux Dedicated Server from the perspective of Linux system administration and basic functionality. The information presented here is not all-inclusive, nor will the technology behind these differences be discussed.
Linux system administrators seeking a comprehensive guide to their virtualization platform of choice should consult the OpenVZ Documentation or Xen Documentation.
Contents |
The following differences can be noted on either the OpenVZ or Xen virtualization platforms:
Hardware clock workaround: VPSLink runs NTP on all hardware nodes to ensure server time is reported accurately. Setting the Linux System Timezone is a reliable way to synchronize your VPS time with your local time.
Configuration reset workaround: Add configuration commands to your /etc/rc.local file to reconfigure your VPS whenever it is booted.
Any allocations in excess of your VPS memory limit (RAM) will result in processes being killed on OpenVZ – please see the Problem: Process or Daemon Dies article for more information on OpenVZ’s behavior and troubleshooting.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chmod a+x /bin/laden - allows anyone to execute Bin Laden
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Rolling back yum packages:
http://dailypackage.fedorabook.com/index.php?/archives/17-Wednesday-Why-Repackaging-and-Rollbacks.html
http://www.vincentverhagen.nl/2007/12/10/how-to-roll-back-packages-on-centos-5-rhel-5/
When you’ve installed/updates packages with yum or rpm, you can quite easily roll back the updates/installations using rpm.
For this, yum and rpm need to save roll back information, which they do not do by default.
To enable the roll back feature, do the following:
Add tsflags=repackage to /etc/yum.conf.
Add %_repackage_all_erasures 1 to /etc/rpm/macros. If /etc/rpm/macros does not exist, just create it.
You can now install, erase and update packages with yum and/or rpm, and they will save roll back information.
When you want to roll back, use rpm to do so.
You do this by specifying the –rollback switch and a date/time, like the examples below:
rpm -Uhv –rollback ’19:00′
rpm -Uhv –rollback ’8 hours ago’
rpm -Uhv –rollback ‘december 31′
rpm -Uhv –rollback ‘yesterday’
/**
* Returns an associative array with the details of the database connection
*
* @param string $application the name of a valid application (i.e.: frontend) – used to get a Propel connection
* @param string $environment the environment we want to apply the deltas to
* @return array(of strings) the keys are: name, host, user, password
*/
public static function getDatabaseConnectionDetails($application, $environment)
if (preg_match(‘/dbname=([^;]+);/’, $databaseDsn, $matches))
{
$databaseConnectionDetails['name'] = $matches[1];
}
else
{
throw new sfException(sprintf(‘Unable to get the database name.’));
}
if (preg_match(‘/;host=(.+)/’, $databaseDsn, $matches))
{
$databaseConnectionDetails['host'] = $matches[1];
}
else
{
throw new sfException(sprintf(‘Unable to get the host for the database.’));
}
$user = $databaseConfig['propel']['datasources']['propel']['connection']['user'];
if ($user)
{
$databaseConnectionDetails['user'] = $user;
}
else
{
throw new sfException(sprintf(‘Unable to get the username for the database.’));
}
$password = $databaseConfig['propel']['datasources']['propel']['connection']['password'];
if ($password)
{
$databaseConnectionDetails['password'] = $password;
}
else
{
throw new sfException(sprintf(‘Unable to get the username for the database.’));
}
return $databaseConnectionDetails;
}