This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# | |
# Credit goes to: http://stackoverflow.com/questions/1876754/split-up-a-mysqldump-file-with-multiple-databases-by-database | |
# | |
# splitmysqldump - split mysqldump file into per-database dump files. | |
use strict; | |
use warnings; | |
my $dbfile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
USRHOMEDIR=`echo $(cd ~)`/ | |
FIXER=php-cs-fixer.phar | |
PROJECTROOT="$1" | |
if [ ! -e ${USRHOMEDIR}${FIXER} ]; then | |
echo "PHP-CS-Fixer not available, downloading to ${USRHOMEDIR}${FIXER}..." | |
curl -s http://cs.sensiolabs.org/get/$FIXER > ${USRHOMEDIR}${FIXER} | |
echo "Done. First time to check the Coding Standards." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# New version, credits to tcky on /r/linux | |
# add this to .zshrc/.bashrc | |
# dependent to "toilet" package | |
# works like : http://i.imgur.com/xdcz614.png | |
function fuck() { | |
if [ ! -z "$1" ]; then | |
pgrep -lfn $1 | |
echo -n "kill? (y/N) " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A reference for parsing date from name. This one parses "2014-04-13_xx-xx-xx" format and prints filenames named before 2 weeks. | |
ls -1 | sort | awk -F_ -v wk=`date --date="2 weeks ago" +%Y-%m-%d` '{if ($1 < wk) print $1"_"$2 }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# requires "empty": http://empty.sourceforge.net/ | |
# ubuntu users also should check http://ubuntuforums.org/showthread.php?t=2131632 | |
function helpshow() { | |
echo " | |
Usage: | |
$0 192.168.1.5 192.168.1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PORT=$1 | |
if [[ `echo stats | nc -w 1 127.0.0.1 $PORT | grep STAT | head -1 | awk {'print $1'}` == "STAT" ]]; then | |
#Response OK | |
exit 0 | |
else | |
#No response - FAIL | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name cloud.domain.net; | |
return 301 https://$server_name$request_uri; # enforce https | |
} | |
server { | |
listen 443 ssl spdy; | |
gzip off; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# RANDOM GULME SCRIPTI | |
# DEPS: xclip & xte (xautomation) | |
#!/bin/bash | |
len=`echo $((RANDOM%7+2))` | |
prefix=`< /dev/urandom tr -dc asdf | head -c 4` | |
devam=`< /dev/urandom tr -dc a-zA-Z0-9 | head -c $len` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scrot /tmp/screen.png | |
convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png | |
[[ -f $HOME/Pictures/Icons/lock.png ]] && convert /tmp/screen.png $HOME/Pictures/Icons/lock.png -gravity center -composite -matte /tmp/screen.png | |
#dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop | |
i3lock -n -t -i /tmp/screen.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://northernmost.org/blog/find-out-what-is-using-your-swap/ | |
# Get current swap usage for all running processes | |
# Erik Ljungstrom 27/05/2011 | |
SUM=0 | |
OVERALL=0 | |
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do | |
PID=`echo $DIR | cut -d / -f 3` | |
PROGNAME=`ps -p $PID -o comm --no-headers` | |
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'` |
OlderNewer