Skip to content

Instantly share code, notes, and snippets.

View seqizz's full-sized avatar
💩
why the heck github has status support

Gürkan seqizz

💩
why the heck github has status support
View GitHub Profile
@seqizz
seqizz / split database dump
Last active August 1, 2021 03:04
Splitting --all-databases backup to per-database .sql files.
#!/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;
#!/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."
@seqizz
seqizz / fuck.sh
Last active December 17, 2015 05:25
Fuck with approval
# 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) "
@seqizz
seqizz / date parser from filename
Last active August 29, 2015 14:00
Parse date from filename (awk)
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 }'
@seqizz
seqizz / change_password.sh
Last active August 29, 2015 14:00
Bulk Change Password
#!/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
@seqizz
seqizz / check_memcached.sh
Created July 9, 2014 14:57
Check memcached
#!/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
@seqizz
seqizz / cloud.domain.net.vhost
Last active August 29, 2015 14:04
Nginx PHP-fpm virtualhost config for Owncloud 7
server {
listen 80;
server_name cloud.domain.net;
return 301 https://$server_name$request_uri; # enforce https
}
server {
listen 443 ssl spdy;
gzip off;
@seqizz
seqizz / random
Last active September 16, 2015 12:39
Generate random & paste
#!/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`
@seqizz
seqizz / lock.sh
Created May 12, 2015 13:05
i3lock with pixelize effect
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
@seqizz
seqizz / swap.sh
Last active August 29, 2015 14:22
Swap usage by process
#!/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 }'`