Skip to content

Instantly share code, notes, and snippets.

View frugan-dev's full-sized avatar
🍎
VegDev

Frugan frugan-dev

🍎
VegDev
View GitHub Profile
@frugan-dev
frugan-dev / siren.go
Created April 5, 2018 22:56 — forked from rafi/siren.go
Israel siren alert notifier implementation in PHP, Go and Python. Go and Python just parse.
package main
// Credits: http://stackoverflow.com/a/24683083/351947
import (
"encoding/binary"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"unicode/utf16"
@frugan-dev
frugan-dev / flexbox.less
Created May 14, 2017 00:02 — forked from jayj/flexbox.less
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@frugan-dev
frugan-dev / auth.pl
Created October 31, 2016 13:44 — forked from mmriis/auth.pl
IMAP/POP3 proxy authentication script for nginx. See http://www.whatastruggle.com/nginx-as-an-imappop3-proxy-part-2.
#!/usr/bin/perl
use Digest::HMAC_MD5 qw/ hmac_md5_hex /;
use DBI;
use URI::Escape;
use CGI;
print "Content-type: text/html\n";
my $q = CGI->new;
@frugan-dev
frugan-dev / gist:052123eb909f58d3497370150636947e
Created October 30, 2016 20:11 — forked from seanmcn/gist:62a021a765ad4f8e593b
The Perfect Web Server - Nginx, Ajenti, Ubuntu
#Insall Ajenti
apt-get update
wget http://repo.ajenti.org/debian/key -O- | apt-key add -
echo "deb http://repo.ajenti.org/ng/debian main main ubuntu" >> /etc/apt/sources.list
apt-get update
apt-get install ajenti
service ajenti restart
# Uninstall Apache2
sudo apt-get autoremove && sudo apt-get remove apache2*
@frugan-dev
frugan-dev / install-pre-commit.sh
Created June 21, 2016 17:57 — forked from stefansundin/install-pre-commit.sh
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/bin/sh
# This script will install a Git pre-commit hook that stop accidental commits to master and develop branches.
# There is also a variant that includes a core.whitespace check. See pre-commit-2 below.
# Install in current Git repo:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh
# Install with core.whitespace check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-2
# Install with core.whitespace check and EOF-newline-check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-3
# Install only core.whitespace check:
@frugan-dev
frugan-dev / dump.sh
Created May 11, 2016 22:36 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@frugan-dev
frugan-dev / flush.php
Created May 5, 2016 10:01 — forked from agarzon/flush.php
PHP Flush Output
<?php
@ini_set('zlib.output_compression', 0);
@ini_set('output_buffering', 0);
@ob_end_clean();
ob_implicit_flush(true);
for($i=0; $i<10; $i++){
echo $i;
@frugan-dev
frugan-dev / auth-vhost.conf
Created November 3, 2015 11:43 — forked from sobstel/auth-vhost.conf
Passing HTTP AUTH BASIC/DIGEST headers from Apache to PHP-FPM
<VirtualHost *>
ServerName auth.dev
DocumentRoot "/var/www/auth"
ProxyPassMatch ^(/.*\.php)$ fcgi://127.0.0.1:9000/var/www/auth
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</VirtualHost>
# compress the code
php_value auto_prepend_file ./prepend.php
php_value auto_append_file ./append.php
<?php
/**
* GD Watermark Lib Plugin Definition File
*
* This file contains the plugin definition for GD Watermark
* Usage:
* <?php
* require_once 'path/to/ThumbLib.inc.php';
* $pic = PhpThumbFactory::create('path/to/pic/destination');
* $watermark = PhpThumbFactory::create('path/to/watermark/destination');