Skip to content

Instantly share code, notes, and snippets.

Sean cybersholt

Block or report user

Report or block cybersholt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cybersholt / s3_ranger.php
Created Jul 12, 2019
Ranger like function for s3, get just enough of an image to read the dimensions.
View s3_ranger.php
function s3Ranger($key)
// inspired by
$s3 = new S3Client(
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => [
'key' => $key,
cybersholt / stream.php
Last active Jun 2, 2019
symfony - streamAction
View stream.php
// Original @
use SplFileInfo;
use RuntimeException;
// Symfony >= 2.1
use Symfony\Component\HttpFoundation\StreamedResponse;
public function streamAction($fileName) {
cybersholt / getErrorMessages.php
Created Feb 21, 2019 — forked from WishCow/getErrorMessages.php
One of the new symfony releases (probably 2.1) broke the previous gist, because $form->getErrors() now returns a sequentially indexed array, instead of a fieldname => errormsg one.
View getErrorMessages.php
private function getErrorMessages(\Symfony\Component\Form\Form $form) {
$errors = array();
if ($form->hasChildren()) {
foreach ($form->getChildren() as $child) {
if (!$child->isValid()) {
$errors[$child->getName()] = $this->getFormErrors($child);
cybersholt /
Created Oct 23, 2018 — forked from addyosmani/
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

cybersholt / nginx-proxy.conf
Created Aug 22, 2018 — forked from noogen/nginx-proxy.conf
nginx proxy example
View nginx-proxy.conf
proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=my_diskcached:10m max_size=5g inactive=45m use_temp_path=off;
server {
listen 80;
set $cache_uri $uri;
location ~ /purge(/.*) {
proxy_cache_purge my_diskcached acme.mycachedefault$uri$is_args$args;
cybersholt /
Created Apr 6, 2018 — forked from hollodotme/
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
cybersholt / config.user.php
Last active Mar 15, 2018
Pimp My Log - PML - Joomla Log Parse Regex
View config.user.php
"joomla1": {
"display": "Joomla Error Log",
"path": "/var/www/sites/REMOVED/log/error.php",
"refresh": 5,
"max": 10,
"notify": true,
"format": {
"type": "Joomla",
"regex": "|^((\\d{4})-(\\d{2})-(\\d{2})T(\\d{2})\\:(\\d{2})\\:(\\d{2})[+-](\\d{2})\\:(\\d{2}))\\t(.*?)\\s(.*?)\\t(.*?)\\t(.*?)[^\\r\\n]*$|U",
"export_title": "Error",
cybersholt /
Created Feb 23, 2018
Swap for CentOS 7
# Creates SWAP on the server
# One of the things that I have lerned is that this kind of servers need swap.
# With these fast SSD disks you gain kind of "pseudo-ram"!!!.
sudo dd if=/dev/zero of=/swapfile bs=1G count=1
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab
sudo sysctl vm.swappiness=10
sudo echo "vm.swappiness=10" >> /etc/sysctl.conf
cybersholt / image-proxy.conf
Created Feb 22, 2018 — forked from tmaiaroto/image-proxy.conf
Nginx Image Filter Resize Proxy Service
View image-proxy.conf
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
cybersholt /
Last active Feb 22, 2018
Build NGINX from source

Install "Development Tools" and Vim editor: sudo yum groupinstall -y 'Development Tools' && sudo yum install -y vim

Install Extra Packages for Enterprise Linux (EPEL): sudo yum install -y epel-release

Download and install optional NGINX dependencies: sudo yum install -y perl perl-devel perl-ExtUtils-Embed libxslt libxslt-devel libxml2 libxml2-devel gd gd-devel GeoIP GeoIP-devel

You can’t perform that action at this time.