Skip to content

Instantly share code, notes, and snippets.

<?php
echo "Hello World\n";
?>
@indrekots
indrekots / server.xml
Created October 8, 2013 11:05
Tomcat server.xml connector conf for enabling SSL
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/path/to/keystore"
keystorePass="password" />
@indrekots
indrekots / keytool.sh
Created October 8, 2013 11:13
Create a new keystore with Java keytool
$JAVA_HOME/bin/keytool -genkey -alias mydomain -keyalg RSA -keystore /path/to/keystore
@indrekots
indrekots / output.txt
Last active December 24, 2015 23:49
Example output while creating a new certificate with Java keytool
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: John Smith
What is the name of your organizational unit?
[Unknown]: John's Diner
What is the name of your organization?
[Unknown]: John's Diner
What is the name of your City or Locality?
[Unknown]: Paris
@indrekots
indrekots / cron.sh
Created October 8, 2013 12:22
Setting cron job for user www-data
sudo -u www-data crontab -e
@indrekots
indrekots / autoloader.php
Last active December 24, 2015 23:59
Require PHP app autoloader
<?php
require_once '/path/to/app/autoloader.php';
...
?>
@indrekots
indrekots / crontab.sh
Created October 8, 2013 13:26
Open crontab editor
crontab -e
@indrekots
indrekots / cronjob
Created October 8, 2013 13:27
Example cron job
*/2 * * * * php /home/user/Desktop/hw.php >> /home/user/Desktop/hw.log
@indrekots
indrekots / error.txt
Created October 11, 2013 09:09
Cannot redeclare class error with PHP
PHP Fatal error: Cannot redeclare class application\models\ChildModel in /var/www/demo/app/models/ChildModel.php on line 49
@indrekots
indrekots / ChildModel.php
Created October 11, 2013 09:27
Defining a "belongs to" relation using Yii's Active Record
<?php
...
public function relations() {
return array(
'parentModel' => array(self::BELONGS_TO, 'ParentModel', 'parent_model_id')
);
}
...