Skip to content

Instantly share code, notes, and snippets.

View harunyardimci's full-sized avatar

harun yardimci harunyardimci

  • http://gravatar.com/hyardimci
View GitHub Profile
# add this to /etc/bashrc or /etc/profile
#------------------------------------------
CPUTIME=$(ps -eo pcpu | awk 'NR>1' | awk '{tot=tot+$1} END {print tot}')
CPUCORES=$(cat /proc/cpuinfo | grep -c processor)
UP=$(echo `uptime` | awk '{ print $3 " " $4 }')
echo "
System Status
Updated: `date`
source /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh
export TERM="xterm-color"
PS1="\`if [ \$? = 0 ]; then echo '\[\033[01;32m\]✓ \[\033[00m\]'; else echo '\[\033[01;31m\]✖ \[\033[00m\]'; fi\`\u@\h: \[\033[01;32m\]\w\[\033[01;34m\]\$(__git_ps1)\[\033[00m\]\$ "
#!/bin/bash
SUMMARY=$1
DESC=$2
JIRA_URL="http://localhost/rest/api/2/issue/"
JIRA_PROJ="Projectkey"
JIRA_ISSUE_TYPE="Bug"
JIRA_USER="username"
JIRA_PASS="password"
sudo tcpdump -A -s 10240 'tcp port 8080 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | egrep --line-buffered "^........(GET |HTTP\/|POST |HEAD )|^[A-Za-z0-9-]+: " | sed -r 's/^........(GET |HTTP\/|POST |HEAD )/\n\1/g'
@harunyardimci
harunyardimci / gist:f6a4af5687bd3972f32d
Last active August 29, 2015 14:07
Enable - disable pools on F5 and netscaler
# F5
ssh ${LB-HOST} tmsh modify ltm node ${SERVICE_NAME} state user-up
ssh ${LB-HOST} tmsh modify ltm node ${SERVICE_NAME} state user-down
# Netscaler
expect nsauth.exp ${USER} ${PASS} ${LB-HOST} "enable service ${SERVICE_NAME}"
expect nsauth.exp ${USER} ${PASS} ${LB-HOST} "disable service ${SERVICE_NAME}"
@harunyardimci
harunyardimci / gist:fb9022d18a9b4b7f957c
Created July 29, 2014 15:43
To change email and author from old git commits
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ];
then
GIT_AUTHOR_NAME="New Name";
GIT_AUTHOR_EMAIL="[email protected]";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
GIT_CURL_VERBOSE=1 GIT_TRACE=1 git pull origin master
@harunyardimci
harunyardimci / httpd-vhost.conf
Created July 1, 2014 21:10
Dynamic apache virtual host configuration
<VirtualHost *:80>
ServerName *.*.*.local.dev
SetEnv APPLICATION_ENV "development"
VirtualDocumentRoot /var/www/some_path/%1/%2/public/%3
<Directory "/var/www/developers_repo_path/*/*">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
strace -vvvfFtT -s 65536 $(for pid in $(ps -C httpd -o pid=); do echo -n "-p $pid "; done)
strace -c $(for pid in $(ps -C httpd -o pid=); do echo -n "-p $pid "; done)
@harunyardimci
harunyardimci / gist:8955138
Last active August 29, 2015 13:56
find connected hostnames from netstat output
netstat -tuna | awk '$5 ~ /^[0-9]/ { print $5 }' | sed -e '/:[0-9]*/s/:[0-9]*//' | sort | uniq -c | sort -rn | while read line; do COUNT=$(echo $line | awk '{ print $1 }'); IP=$(echo $line | awk '{ print $2 }'); HNAME=$(dig +short -x ${IP}); if [ -z "$HNAME" ]; then HNAME=${IP}; fi; echo ${COUNT} ${HNAME}; done