This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding:utf-8 -*- | |
import itertools | |
import requests | |
import json | |
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | |
password_length = 6 | |
gen = itertools.combinations_with_replacement(characters,password_length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<time datetime="<?php echo date('Y-m-d\Th:m:sO', strtotime($publishedDate)); ?>" ><?php echo date('l jS F Y', strtotime($publishedDate); ?></time> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
tmp_usage=$(df -h /tmp/ | tail -1 | awk '{print $4}' | awk -F "%" '{print $1}') | |
if [ $tmp_usage -gt 90 ]; then | |
echo "Your /tmp folder is $tmp_usage% full, please investigate" | mail -s "TMP folder on <server-id>" [email protected]; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /etc/nginx/logs/access.log | awk '{print $1 " " $4 " " $5 " " $6 " " $7}' | grep 'url' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = "abcdefgh"; | |
$regex = "/^[a-z]+$/i"; | |
// Syntax is preg_match(regex, string, [, out_matches [, flags [, offset]]]); | |
if (preg_match($regex, $string)) { | |
printf("Pattern '%s' found in string '%s'\n", $regex, $string); | |
} else { | |
printf("No match found in string '%s'!\n", $string); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteBase /subfolder/ | |
RewriteCond %{REQUEST_URI} !^/subfolder | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^([a-z]+)/$ $1.php | |
RewriteRule ^([a-z]+-?[a-z]+)/$ $1.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server{ | |
listen 80; | |
server_name <domine>; | |
access_log /var/log/<domine>.access_log; | |
error_log /var/log/<domine>.error_log; | |
root <domine_path>; | |
location ~ ^/resize/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CACHEDIR= | |
MAXSIZE=100 | |
DIRSIZE=`du -s $CACHEDIR | cut -f 1` | |
MINFILES=5 | |
echo $DIRSIZE' : '$CACHEDIR | |
#ls -t cache | sed -e '1,10d' | xargs -d '\n' rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$resizer = new Resizer(); | |
$resizer->setRequestFileInfo($_GET['path']); | |
$resizer->setRequestHight($_GET['hight']); | |
$resizer->setRequestWidth($_GET['width']); | |
$resizer->setRequestMode($_GET['mode']); | |
$resizer->generateImage(); | |
/** |