You can run these commands to encrypt or decrypt a string:
To encrypt:
printf "Lorem ipsum dolor sit amet, ..." | \
openssl enc -e -base64 -A -aes-256-cbc -pass pass:"my-password"
To decrypt:
<?php | |
/** | |
* simple method to encrypt or decrypt a plain text string | |
* initialization vector(IV) has to be the same when encrypting and decrypting | |
* | |
* @param string $action: can be 'encrypt' or 'decrypt' | |
* @param string $string: string to encrypt or decrypt | |
* | |
* @return string | |
*/ |
This is helpful when you don't want to disable SELinux but do want to allow apache to execute an external program. For example wkhtmltopdf. Run the following commands from the terminal. (This has been tested in CentOS 7.)
setsebool httpd_execmem on
Change a dirs security context if the program writes to a file
1. Go to Sublime Text to: Tools -> Build System -> New Build System | |
and put the next lines: | |
{ | |
"cmd": ["python3", "-u", "$file"], | |
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)", | |
"selector": "source.python" | |
} | |
Then save it with a meaningful name like: python3.sublime-build |
#Install Predawn and Agila themes first | |
{ | |
"bold_folder_labels": true, | |
"caret_extra_width": 2, | |
"caret_style": "smooth", | |
"color_scheme": "Packages/Predawn/predawn.tmTheme", | |
"fade_fold_buttons": false, | |
"font_face": "Inconsolata", | |
"font_size": 12, |
.bottom-panel { | |
/* .window-button-icon height + | |
.window-button vertical padding + | |
.window-button > StWidget vertical padding) */ | |
height: 2.25em; | |
} | |
.window-list { | |
spacing: 2px; | |
font-size: 10pt; |
# -*- coding: utf-8 -*- | |
import Image | |
def resize_and_crop(img_path, modified_path, size, crop_type='top'): | |
""" | |
Resize and crop an image to fit the specified size. | |
args: | |
img_path: path for the image to resize. |
input | |
{ | |
file | |
{ | |
path => ["/home/logstash/crawler/*.json"] | |
start_position => "beginning" | |
sincedb_path => "/dev/null" | |
exclude => "*.gz" | |
} |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.