Skip to content

Instantly share code, notes, and snippets.

@anothergituser
anothergituser / iptables_user
Last active Jan 20, 2019
iptables systemctl /etc/rc.d/init.d/iptables_user
View iptables_user
#!/bin/bash
# chkconfig: - 50 50
# description: Initializes custom firewall
usage ()
{
echo $"Usage: $0 {start|stop|status|restart|condrestart}" 1>&2
}
start ()
View rules.sh
#!/bin/bash
# https://wiki.archlinux.org/index.php/simple_stateful_firewall
iptables -F
iptables -X
iptables -N TCP
iptables -N UDP
iptables -P INPUT DROP
View .screenrc
autodetach on
startup_message off
hardstatus alwayslastline
shelltitle 'bash'
hardstatus string '%{gk}[%{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= w}%?%+Lw%?%? %{g}][%{d}%l%{g}][ %{= w}%Y/%m/%d %0C:%s%a%{g} ]%{W}'
bindkey -k k6 prev
bindkey -k k7 next
@anothergituser
anothergituser / backup.sh
Last active Jun 23, 2017
rsync website backup script
View backup.sh
#!/bin/bash
# Website Backup Script
# http://webgnuru.com/linux/rsync_incremental.php
# Adapted to be run by anacron
# before running the script for the first time
# full_incremental should contain a dir like 2017-01-01
# empty or having a full backup
View convert icons and splash image for ionic
find . -iname "*.png" -exec file {} \; | awk '{print "convert source.png -resize",$5"x"$7,"out/"$1}' | sed 's/\(,\|:\|\.\/\)//g' > convert.sh
@anothergituser
anothergituser / gist:70a9572ec39eab5c8b1a
Created Oct 31, 2015
Watch laravel log in terminal using tail and grep
View gist:70a9572ec39eab5c8b1a
tail -f app/storage/logs/laravel.log | grep --line-buffered -v -P '(^#\d+|^Stack)'
@anothergituser
anothergituser / global.php
Created Jul 27, 2015
Laravel 4.2 clean logs
View global.php
App::error(function(Exception $exception, $code)
{
if ($exception instanceof Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
Log::error([
'route' => Request::fullUrl(),
'user_id' => Auth::check() ? Auth::id() : "Anonymous",
'code' => $code,
'ip' => Request::ip(),
'headers' => Request::header('user-agent')
]);
View tmux.conf
#Prefix is Ctrl-a
set -g prefix C-a
bind C-a send-prefix
unbind C-b
#Mouse works as expected
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
@anothergituser
anothergituser / ioc.php
Created Jun 24, 2012
PHP 5.3 Lightweight IOC container
View ioc.php
<?php
/*
* Lightweight IOC container
*/
class IOC {
// if a hinted class name is matched here
// use the associated value as the new class