Skip to content

Instantly share code, notes, and snippets.

View marios88's full-sized avatar

marios88

  • Greece
View GitHub Profile
@marios88
marios88 / README.md
Last active October 24, 2015 09:49 — forked from faizal2007/LICENSE
Bash Image Optimization for web

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
@marios88
marios88 / README.md
Last active February 3, 2017 15:17
Postfix cron based rate limiting / throttling with mail alert and automatic postfix shutdown on abnormal queue size

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 / image_autorotate.php
Created July 21, 2017 15:21 — forked from codee/image_autorotate.php
CodeIgniter: Automatic image rotation library
<?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 / gist:2fd500e8ea49b2f5f7ce54b16b9438df
Created February 21, 2018 13:03
Boostrap v4 tab history
$(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');
#!/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
@marios88
marios88 / gist:6f3a276a5aff9d649d2581e52935f205
Created July 24, 2020 10:10
Aspell export Greek dictionary
aspell --lang el dump master | aspell --lang el expand | tr ' ' '\n' > el.dic
@marios88
marios88 / gist:050ad50528edcb7e0a9d98d527f252a9
Created December 22, 2020 14:45
Find PDFs in current folder and subfolders, run ps2pdf with parallel execution and replace on the fly
nohup find . -name '*.pdf' | xargs -n 1 -P 8 -I % sh -c 'ps2pdf "%" - | sponge "%";echo "%"' &
@marios88
marios88 / danted.conf
Created June 27, 2021 15:52
Dante 1.4 socks5 proxy simple configuration
#logging
logoutput: stdout
#debug: 1
#server address specification
internal: 192.168.1.51 port = 1080
external: eth0
#server identities (not needed on solaris)
#user.privileged: root
@marios88
marios88 / gist:031939dd47609a9b3083a1988fc1fd22
Last active September 17, 2021 11:36
Online resize with hpacucli to expand array's logical disk size when new larger disk are added
Replace slot=x
Replace ld ( LD not id ) with target logical disk
> hpacucli
> ctrl slot=2 show config detail
> ctrl slot=2 ld 1 modify size=max
> Warning: Extension may not be supported on certain operating systems.
Performing extension on these operating systems can cause data to
become inaccessible. See ACU documentation for details. Continue?
@marios88
marios88 / gist:f1c92347cc781f8bc9939e10c5460320
Last active April 25, 2022 19:53
ffmpeg change audio codec to ac3
./mountRPI.sh
// Make audio AC3
ffmpeg -i input.mkv -acodec ac3 -vcodec copy -c:s copy -map 0 -analyzeduration 999999999 -probesize 999999999 ~/RPI/EXTERNAL/Tainies/output.mkv
// Make audio AC3 and remove Subs
ffmpeg -i input.mkv -acodec ac3 -vcodec copy -map 0 -map -0:s -analyzeduration 999999999 -probesize 999999999 ~/RPI/EXTERNAL/Tainies/output.mkv