Skip to content

Instantly share code, notes, and snippets.

View rodrigoespinozadev's full-sized avatar
🏠
Working from home

Rodrigo Espinoza rodrigoespinozadev

🏠
Working from home
View GitHub Profile
@rodrigoespinozadev
rodrigoespinozadev / phpbrew-config.md
Created January 11, 2019 05:09 — forked from yang-wei/phpbrew-config.md
How to use switch PHP(using phpbrew) version in nginx config
php -v
PHP 5.6.3 (cli) (built: Oct 28 2015 09:47:41)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

But this only changes in CLI. You have to tweak you nginx(same for apache) to make it works. Nginx will still using the native PHP-FPM.

> ps aux | grep php-fpm
@rodrigoespinozadev
rodrigoespinozadev / encrypt_openssl.md
Created January 14, 2019 19:28 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@rodrigoespinozadev
rodrigoespinozadev / .rtorrent.rc
Created January 20, 2019 09:00 — forked from bryanjswift/.rtorrent.rc
rtorrent configuration file with description
# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)
@rodrigoespinozadev
rodrigoespinozadev / preg_match_array.php
Created January 31, 2019 19:30 — forked from mbunge/preg_match_array.php
preg_match over given array with a defined pattern
<?php
/**
* preg_match over given array with a defined pattern
*
* Example:
*
* $names = array(
* 'hans',
* 'dieter',
* 'peter',
@rodrigoespinozadev
rodrigoespinozadev / docker.sh
Created March 6, 2019 20:06 — forked from monkeym4ster/docker.sh
Docker: save/load container using tgz file (tar.gz)
#for not running docker, use save:
docker save <dockernameortag> | gzip > mycontainer.tgz
#for running or paused docker, use export:
docker export <dockernameortag> | gzip > mycontainer.tgz
#load
gunzip -c mycontainer.tgz | docker load
version: '3'
services:
nginx:
image: awsdemo-nginx:latest
ports:
- "80:80"
volumes:
- static_volume:/usr/src/app/staticfiles
- media_volume:/usr/src/app/mediafiles
@rodrigoespinozadev
rodrigoespinozadev / .gitignore
Created March 9, 2019 08:03 — forked from maxcnunes/.gitignore
Git keep empty folder: 1. Add a .gitkeep file inside the folder you want to keep 2. Then include this configuration in your .gitignore
path_your_folder/*
!path_your_folder/.gitkeep
@rodrigoespinozadev
rodrigoespinozadev / docker-image-size.sh
Last active March 22, 2019 16:18 — forked from andyrbell/docker-image-size.sh
Sort docker images by size desc
#!/bin/sh
docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r | column -t
docker images --format '{{.Size}}\t{{.Repository}}' | sort -r
docker images --format '{{.Size}}\t{{.Repository}}' | sort -h
docker images --format '{{.Size}}\t{{.Repository}}:{{.Tag}}\t{{.ID}}' | sort -h | column -t
Inside the docker container, run script /dev/null first. Then you should be able to start screen.