Skip to content

Instantly share code, notes, and snippets.

View greyaperez's full-sized avatar

Grey Perez greyaperez

View GitHub Profile
@greyaperez
greyaperez / IDE Shortcuts
Created November 8, 2013 19:03
Netbeans + Eclipse + IntelliJ / WebStorm : Important Shortcut Keys
# Note if OSX (replace ctrl with cmd key) #
Netbeans
=================
Open Type (Class) - ctrl + o
Find File - alt + Shift + o
Code Suggestions - alt + Enter
Eclipse
@greyaperez
greyaperez / ZFTool
Created November 10, 2013 19:26
ZFTool Usage Reference (ZendFramework 2)
Top 5 Most Important
===================
# zf show help screen
# zf modules show loaded modules
# zf create module <name> [<path>]
# zf create controller <name> <module> [<path>]
# zf create action <name> <controller> <module> [<path>]
Basic information
@greyaperez
greyaperez / whoisport.sh
Created November 13, 2013 19:43
What App is using a specific port. Both linux and cygwin versions included.
# LINUX (TODO)
function whoisport (){
port=$1
pidInfo=$(fuser $port/tcp 2> /dev/null)
pid=$(echo $pidInfo | cut -d':' -f2)
ls -l /proc/$pid/exe
}
# CYGWIN
function whoisport (){
@greyaperez
greyaperez / REST_endpoint.php
Created November 27, 2013 19:37
Just point your REST call to this file and it will store it to a file. Just change $file to whatever file you would like, currently set to request.json. Also remember to chmod that file so it's writable.
<?php
header("Access-Control-Allow-Orgin: *");
header("Access-Control-Allow-Methods: *");
header("Content-Type: application/json");
$requestData = '';
if(isset($HTTP_RAW_POST_DATA) && strlen($HTTP_RAW_POST_DATA) > 0){
@greyaperez
greyaperez / grep_by_ext.sh
Created November 27, 2013 20:35
Grep only in files of a certain Extension in current path.
grep -roi --include *.ext something .
@greyaperez
greyaperez / run_in_background.sh
Created December 3, 2013 20:55
Run Process in Background
nohup ant run > output.log 2>&1 &
@greyaperez
greyaperez / Most_Useful_Shell.sh
Created December 10, 2013 15:42
Some of the most useful bash/shell functions and aliases.
alias editbash='vim ~/.bashrc'
alias updatebash='source ~/.bashrc'
alias ls='ls -alC --color=auto'
function search (){
egrep -roiI $1 . | sort | uniq
}
function whereis (){
find . -name "$1*";
@greyaperez
greyaperez / service_status_all.sh
Created December 10, 2013 18:52
Get status of all services.
service --status-all
@greyaperez
greyaperez / PostgreSQL_Commands.sql
Created December 10, 2013 19:25
Common/Important PostgreSQL Commands
# Common/Important Commands
# See Cheatsheet - http://www.postgresonline.com/downloads/special_feature/postgresql83_cheatsheet.pdf
# Admin
psql
\list lists all databases
\dt lists all tables in the current database
\q quit
@greyaperez
greyaperez / log.sh
Created December 16, 2013 17:04
Logging - with filtering
# Tail Files in Directory
# USAGE: $ log {arg1:file filter(opt)} {arg2:string filter(opt)}
function log (){
if [ $# -lt 1 ];
then
tail -f *
fi
if [ $# -gt 1 ];
then