Skip to content

Instantly share code, notes, and snippets.

marios88

  • Greece
View GitHub Profile
View recodeifneeded
#!/bin/bash
# Find the current encoding of the file
# place in $HOME/bin
# to mass use it
# find "$PWD" -type f -name "*" -exec recodeifneeded utf-8 {} \;
encoding=$(uchardet "$2")
if [[ "$1" != "${encoding}" ]] && [[ "${encoding}" != "UTF-8" ]] && [[ "${encoding}" != "unknown" ]]
then
View gist:2fd500e8ea49b2f5f7ce54b16b9438df
$(function(){
//refresh && link
var hash = window.location.hash;
hash && $('.nav a[href="' + hash + '"]').tab('show');
//back - forward
window.onpopstate = function(event) {
if(window.location.hash == ''){
//no hash in url show the tab you like!
$('.nav a[href="#nav-home"]').tab('show');
@marios88
marios88 / image_autorotate.php
Created Jul 21, 2017 — forked from codee/image_autorotate.php
CodeIgniter: Automatic image rotation library
View image_autorotate.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* @file application/libraries/Image_autorotate.php
*/
class Image_autorotate
{
function __construct($params = NULL) {
if (!is_array($params) || empty($params)) return FALSE;
@marios88
marios88 / README.md
Last active Feb 3, 2017
Postfix cron based rate limiting / throttling with mail alert and automatic postfix shutdown on abnormal queue size
View README.md

NOTHING WORKED, postfix does not want to throttle outgoing emails.NO MORE

This will delay sending emails and put extra load on the cpu

Why, you ask?

My server normaly sends 1000-2000 emails per day, one day a client got hacked and sent out 2million of them Outgoing email workload is fairly predictable in my case

Instructions

add in /etc/postfix/main.cf and copy header_checks to the same location
@marios88
marios88 / README.md
Last active Oct 24, 2015 — forked from wackoen/LICENSE
Bash Image Optimization for web
View README.md

imgoptim

This script is use to optimize image for web

  • This script only optimize jpg and png image
  • Currently this script only support debian
  • jpg strip-all
  • -o9
  • Current folder
./imgoptim
You can’t perform that action at this time.