Skip to content

Instantly share code, notes, and snippets.

View fuadarradhi's full-sized avatar
🔥
On Fire

Fuad Ar-Radhi fuadarradhi

🔥
On Fire
View GitHub Profile
@fuadarradhi
fuadarradhi / openssl_encrypt_decrypt.php
Created March 27, 2018 08:14 — forked from joashp/openssl_encrypt_decrypt.php
Simple PHP encrypt and decrypt using OpenSSL
<?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
*/
@fuadarradhi
fuadarradhi / CryptoJS-AES.md
Created March 27, 2018 09:21 — forked from caiguanhao/CryptoJS-AES.md
CryptoJS AES encryption/decryption JavaScript and command line examples

You can run these commands to encrypt or decrypt a string:

Command

To encrypt:

printf "Lorem ipsum dolor sit amet, ..." | \
  openssl enc -e -base64 -A -aes-256-cbc -pass pass:"my-password"

To decrypt:

Allow apache to execute an external program through SELinux

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.)

Allow Exicution

setsebool httpd_execmem on

Change a dirs security context if the program writes to a file

#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;
@fuadarradhi
fuadarradhi / cuter.py
Created June 27, 2018 05:32 — forked from sigilioso/cuter.py
Python PIL Example: get a thumbnail by resizing and cropping an image.
# -*- 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"
}
@fuadarradhi
fuadarradhi / PPTPD-VPN-in-CentOS6.md
Created July 16, 2018 07:34 — forked from freizl/PPTPD-VPN-in-CentOS6.md
PPTPD VPN in CentOS 6

Install packages

yum install ppp iptables
rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm
yum install pptpd

Route config

@fuadarradhi
fuadarradhi / nginx-tuning.md
Created November 12, 2018 16:53 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

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.