Skip to content

Instantly share code, notes, and snippets.

@rickytato
rickytato / s3.vcl
Created July 6, 2023 13:02 — forked from rezan/s3.vcl
Varnish AWS S3 Gateway VCL
#
# Varnish AWS S3 Gateway VCL
#
# Allows global read (GET, HEAD) and ACL protected writes (POST, PUT, DELETE).
# When writing, pass in Content-Type and Content-MD5, both are optional.
#
# Params:
#
# %BUCKET% - S3 bucket name, S3 host may be regional
# %ACCESS_ID% - IAM access ID for bucket
host-intel:~# stress-ng --cpu 4 --vm 2 --hdd 1 --fork 8 --switch 4 --timeout 5m --metrics-brief
stress-ng: info: [17795] dispatching hogs: 4 cpu, 2 vm, 1 hdd, 8 fork, 4 switch
stress-ng: info: [17800] stress-ng-switch: 1114.57 nanoseconds per context switch (based on parent run time)
stress-ng: info: [17807] stress-ng-switch: 890.93 nanoseconds per context switch (based on parent run time)
stress-ng: info: [17813] stress-ng-switch: 946.57 nanoseconds per context switch (based on parent run time)
stress-ng: info: [17820] stress-ng-switch: 949.06 nanoseconds per context switch (based on parent run time)
stress-ng: info: [17795] successful run completed in 300.74s (5 mins, 0.74 secs)
stress-ng: info: [17795] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s
stress-ng: info: [17795] (secs) (secs) (secs) (real time) (usr+sys time)
stress-ng: info: [17795] cpu 281111 300.01 1194.81 0.03 937.00 235.27
@rickytato
rickytato / proxmox-lxc-resize.sh
Created January 22, 2020 13:37
Increase or decrease disk size of LXC Container on Proxmox
#!/bin/bash
pct stop <id>
vzdump <id> -storage <storage> -compress lzo
pct destroy <id>
pct restore <id> /path/to/storeage/vzdump-lxc-<id>....tar.lzo --rootfs local:<newsize>
@rickytato
rickytato / my.cnf
Created March 7, 2019 19:57 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated December 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
@rickytato
rickytato / gist:a620c96c1e7c0727d9c1928179a62369
Last active September 21, 2018 09:20
NGINX – Easiest way to setup SSL using .pfx files
#
# https://blog.knoldus.com/easiest-way-to-setup-ssl-on-nginx-using-pfx-files/
#
We’ll start by extracting the CRT file using openssl with the following command
openssl pkcs12 -in ./YOUR-PFX-FILE.pfx -clcerts -nokeys -out domain.crt
Followed by extracting the private key with the following command
@rickytato
rickytato / nginx-boringssl-build-script-debian.sh
Created August 30, 2018 12:59 — forked from neilstuartcraig/nginx-boringssl-build-script-debian.sh
This builds NGINX from source with BoringSSL for Debian (alike?) systems with systemd (e.g. Debian Jessie)
#!/bin/bash
LATESTNGINX="1.11.10"
BUILDROOT="/tmp/boring-nginx"
# Pre-req
sudo apt-get update
sudo apt-get upgrade -y
# Install deps
@rickytato
rickytato / Howto convert a PFX to a seperate .key & .crt file
Created January 24, 2018 17:17 — forked from TemporaryJam/Howto convert a PFX to a seperate .key & .crt file
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
@rickytato
rickytato / hhvm.conf
Created June 27, 2017 20:48 — forked from tomazzaman/hhvm.conf
Monit configurations for commonly used services
check process hhvm with pidfile /var/run/hhvm/pid
group hhvm
start program = "/usr/sbin/service hhvm start" with timeout 60 seconds
stop program = "/usr/sbin/service hhvm stop"
if failed unixsocket /var/run/hhvm/hhvm.sock then restart
if mem > 400.0 MB for 1 cycles then restart
if 5 restarts with 5 cycles then timeout
@rickytato
rickytato / a.sh
Created March 30, 2017 15:29 — forked from ryzy/a.sh
Compile OpenSSL 1.0.2 and HAProxy from the source on CentOS 7
# make sure you have these installed
yum install -y make gcc perl pcre-devel zlib-devel
@rickytato
rickytato / HAProxy PEM order
Last active January 4, 2017 11:30 — forked from kehers/gist:48d1dc99c9cae0ceac0c
Order of SSL pem file for HAProxy
1. key
2. crt
3. COMODORSADomainValidationSecureServerCA.crt
4. COMODORSAAddTrustCA
5. AddTrustExternalCARoot