Skip to content

Instantly share code, notes, and snippets.

@valguss
valguss / sshd.conf
Created November 17, 2010 11:10
Check to see if SSHD is ok.
## SSHD monit config , http://www.securecentos.com
## Modified 25/7-2008
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 2345 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
@valguss
valguss / system.conf
Created November 17, 2010 11:09
Check if the system is overloaded. Change CHANGEHOSTNAME to the hostname
## Securecentos.com system.conf for Monit (Updated 12082009)
check system CHANGEHOSTNAME
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
@valguss
valguss / sshd.conf
Created November 17, 2010 10:53
Modify/update these settings
Port 2345
HostKey /etc/ssh/ssh_host_rsa_key
KeyRegenerationInterval 1h
ServerKeyBits 1024
PermitRootLogin no
RSAAuthentication yes
PermitEmptyPasswords no
IgnoreRhosts yes
RhostsRSAAuthentication no
MaxStartups 10
git pull
git push
git branch
git commit
git checkout
git status
git log
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "modification plus 10 days"
</IfModule>
<?php
//this is a variable
$variable;
/* this variable will do some awsome stuff that
could go on for quite
a few lines of awsomeness */
$variable = 1;
<?php
//define and initiate variable
$arrayVariable = array(1,2,3,3);
foreach($arrayVariable as $variable){
//make sure there is something to output
if($variable != ""){
echo $variable;
}
}
@valguss
valguss / php2.php
Created November 15, 2010 17:11
asdads
<?php
foreach($arrayVariable as $variable){
echo $variable;
}
@valguss
valguss / sqlinjection.php
Created November 15, 2010 16:52
mysqlinjection.php
<?php
$name_evil = "'; DELETE FROM customers WHERE 1 or username = '";
$name_evil = mysql_real_escape_string($name_evil);
$query_evil = "SELECT * FROM customers WHERE username = '$name_evil'";
echo "Escaped Evil Injection: <br />" . $query_evil;
<?php
if($i == 2){
?>
<div>
<p>this is a div</p>
<ul>
<?php
while($t == 1){
?>
<li>this is a list item</li>