Skip to content

Instantly share code, notes, and snippets.

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

Anton Paramonov paramonovav

🏠
Working from home
View GitHub Profile
@paramonovav
paramonovav / .htaccess
Created August 21, 2015 14:53
Speed up your site by compressing and caching your content with .htaccess
# BEGIN Compress text files
<ifModule mod_deflate.c>
<filesMatch ".(css|js|x?html?|php)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>
# END Compress text files
# BEGIN Expire headers
<ifModule mod_expires.c>
@paramonovav
paramonovav / .php
Created August 31, 2015 15:55
how to set mpdf HTML contains invalid UTF-8 character(s)
#Try this
$html = mb_convert_encoding($html, 'UTF-8', 'UTF-8');
#before calling: "$mpdf->WriteHTML($html);"
#It's seems senseless, but it works for me.
@paramonovav
paramonovav / .sh
Last active September 2, 2015 10:30
CONVERTING A TRANSPARENT BACKGROUND EPS TO PNG
# Variant 1
#if you’re having colour issues when going from EPS to PNG, try using “-colorspace srgb” instead
convert -density 400 -colorspace rgb TransaprentBackgroundEPS.eps -transparent white Output.png
# Variant 2
convert -alpha off +antialias -density 120 test.eps test.png
@paramonovav
paramonovav / fix_brew.sh
Created September 2, 2015 12:00
Error when brew updating
sudo chown -R `whoami` /usr/local
cd /usr/local
git reset --hard origin/master
#That'll reset you to the upstream version and fix your bad permissions.
@paramonovav
paramonovav / .sh
Created September 9, 2015 08:18
How To Optimize Nginx Configuration
#worker_processes
grep processor /proc/cpuinfo | wc -l
#worker_connections
ulimit -n
@paramonovav
paramonovav / disk-space-alert.sh
Last active September 29, 2015 13:18
Linux disk space email alert
#!/bin/bash
#Send an Email Alert When Your Disk Space Gets Low
[email protected]
[email protected]
DISK=sda1
USED=50
HOST=$(hostname)
CURRENT=$(df $DISK | grep / | awk '{ print $5}' | sed 's/%//g')
@paramonovav
paramonovav / gist:8499dc593a6f3460891a
Created September 29, 2015 07:44 — forked from djangofan/gist:3113588
Cron job script to give a disk space usage alert email
#!/bin/sh
# this script was initially written for Redhat/CentOS
# file is /etc/cron.daily/diskAlert.cron
# requires enabling outgoing sendmail from localhost to a valid
# smtp server, which is usually disabled by default
ADMIN="[email protected],[email protected]"
THRESHOLD=90
df -PkH | grep -vE '^Filesystem|tmpfs|cdrom|media' | awk '{ print $5 " " $6 }' | while read output;
do
# This allows you to redirect your entire website to any other domain
Redirect 302 / http://mt-example.com/
@paramonovav
paramonovav / mailcatcher-install.md
Last active October 28, 2015 10:22 — forked from pitpit/mailcatcher-install.md
Install Mailcatcher on OSX
@paramonovav
paramonovav / FileLog.php
Created October 29, 2015 14:19
Swift Mailer File Logger (3.3.2)
<?php
/**
* Swift Mailer File Logger
* Please read the LICENSE file
* @copyright Anton Paramonov <[email protected]>
* @author Anton Paramonov <[email protected]>
* @package Swift_Log
* @license GNU Lesser General Public License
*/