Skip to content

Instantly share code, notes, and snippets.

View Spir's full-sized avatar
🌴
On vacation

Spir Spir

🌴
On vacation
View GitHub Profile
@Spir
Spir / gist:6198f89f385c63008e583e4f33377cd0
Created May 15, 2018 12:18
jpegoptim & optipng recursive optimization
#!/bin/bash
cd ~/public/;
optimize() {
jpegoptim *.jpg --max=90 --strip-all --preserve --totals
optipng *.png;
for i in *
do
if test -d $i
@Spir
Spir / firewall
Created March 20, 2014 08:54
iptables settings
#!/bin/sh
# firewall settings
### BEGIN INIT INFO
# Provides: firewall
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: iptables firewall
@Spir
Spir / ImageOptimize
Last active November 17, 2016 20:22
Simple command for Laravel 4 to optimize your images using jpegoptim and optipng. Fill in the $imagesFolders array and run. http://freecode.com/projects/jpegoptim http://optipng.sourceforge.net/
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ImageOptimize extends Command {
/**
* The console command name.
@Spir
Spir / Composer dependencies builder
Last active December 17, 2015 17:08
Functions to build a Composer depencied tree for Laravel (make use of Laravel app_path() to get the path of the composer/installed files
function buildDependenciesTree() {
$composer = json_decode((string)(file_get_contents(app_path().'/../composer.json')));
$installed = json_decode((string)(file_get_contents(app_path().'/../vendor/composer/installed.json')));
$tree = Array();
foreach($composer->require as $lib => $version) {
// skip PHP and other non lib requirements
if (!is_dir(app_path().'/../vendor/'.$lib))
continue;
$tree[] = loadDependencies($installed, $lib);