Skip to content

Instantly share code, notes, and snippets.

@rickytato
rickytato / ssh_speed.sh
Last active December 1, 2015 13:34
SSH ciphers speed
CIPHERS=`ssh -Q cipher`
for c in $CIPHERS; do
dd if=/dev/zero bs=1000000 count=1000 2> /dev/null | ssh -c $c localhost "(time -p cat) > /dev/null" 2>&1 | grep real | awk '{print "'$c': "1000 / $2" MB/s" }'
done
# My results:
# aes128-ctr: 108.108 MB/s
# aes192-ctr: 108.932 MB/s
# aes256-ctr: 114.416 MB/s
@rickytato
rickytato / benchmark.php
Created May 1, 2016 13:54 — forked from BlakeGardner/benchmark.php
Benchmark of all the hashing algorithms provided by PHP
<?php
foreach (hash_algos() as $algo) {
$start_time = microtime(TRUE);
for ($index = 0; $index <= 500000; $index++) {
$hash = hash($algo, $index);
}
@rickytato
rickytato / set_php_fpm_affinity.sh
Created May 3, 2016 16:44 — forked from kamermans/set_php_fpm_affinity.sh
Set PHP-FPM pool workers CPU affinity so each worker gets one CPU core
#!/bin/bash
# Set PHP-FPM pool workers CPU affinity so each worker gets one CPU core
# Note that FPM recycles threads, so you'll need to run this on cron periodically
# Author: Steve Kamerman
CPUS=$(grep -c processor /proc/cpuinfo)
FPM_PIDS=$(ps auxw | grep php-fpm | grep pool | awk '{ print $2; }')
if [ "$FPM_PIDS" = "" ]; then
@rickytato
rickytato / gist:21eec6e01fc8102cc6eb29623aeac95f
Created May 4, 2016 16:17
PHP serializer benckmark (json, igbinary, msgpack)
[integer ] default json igbinary msgpack
status : OK OK OK OK
serialize : 0.0134 (100%) 0.0078 ( 58%) 0.0075 ( 56%) 0.0083 ( 62%)
unserialize: 0.0158 (100%) 0.0185 (117%) 0.0071 ( 44%) 0.0101 ( 64%)
size : 13 (100%) 10 ( 76%) 9 ( 69%) 5 ( 38%)
[double ] default json igbinary msgpack
status : OK OK OK OK
serialize : 0.0308 (100%) 0.0108 ( 35%) 0.0076 ( 24%) 0.0079 ( 25%)
unserialize: 0.0285 (100%) 0.0203 ( 71%) 0.0072 ( 25%) 0.0101 ( 35%)
Security Groups associated with i-fa630e70
Ports Protocol Source Elasticsearch default CiviCRM-SSHSecurityGroup-BLKCHMKH81UK
9300 tcp 2.229.13.115/32, 78.152.108.245/32 ✔
9200 tcp 2.229.13.115/32, 78.152.108.245/32, 172.31.30.110/32, 52.51.110.165/32 ✔
All All sg-a46448c0 ✔
22 tcp 0.0.0.0/0 ✔
8022 tcp 0.0.0.0/0 ✔
" https://github.com/rickytato/vim-plug
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call plug#begin('~/.vim/plugged')
Plug 'junegunn/vim-easy-align'
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
@rickytato
rickytato / dash-avc264 command lines
Created December 1, 2016 15:30 — forked from ddennedy/dash-avc264 command lines
Use ffmpeg and mp4box to prepare DASH-AVC/264 v1.0 VoD
See my DASH-IF presentation from October, 2014:
https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/
1. encode multiple bitrates with keyframe alignment:
ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \
-g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4
My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment
size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012.
@rickytato
rickytato / README.md
Created December 2, 2016 11:08 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@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
@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