Skip to content

Instantly share code, notes, and snippets.

View mmaha's full-sized avatar

M Maha mmaha

  • Canada
View GitHub Profile
@mmaha
mmaha / locate_most_filetypes.sh
Created February 2, 2011 15:55
Does a locate on specified filetypes;
#!/usr/bin/env sh
# Might need to adjust awk $3 $4 according to OS
# Add $5 and so on to get more granularity
# This one is for Mac OSX
# *Test* it out with various files. YMMV.
locate "$1" | awk -F/ '{gsub($NF,""); print $3 "/" $4}' \
| sort | uniq -c
@mmaha
mmaha / cal-next-month.sh
Created September 4, 2011 12:37
Display calendar for next month
#!/bin/sh
cal $(date -v +1m "+%m %Y")
@mmaha
mmaha / display-calendar.sh
Created September 4, 2011 12:39
Display calendar with current date colored
#!/bin/sh
cal | GREP_COLOR="32" grep --color -C6 -E "(^| )$(date +%e)"
@mmaha
mmaha / glogin.sql
Created October 18, 2011 18:09
$ORACLE_HOME/sqlplus/admin/glogin.sql
SET sqlprompt '&_user:&_connect_identifier > '
define _editor=vi
@mmaha
mmaha / gist:1296236
Created October 18, 2011 18:26
sqlplus startup & shutdown commands (ORACLE_HOME and ORACLE_SID needs to be set.)
Enter the following commands to shut down the instance:
$ sqlplus /nolog
SQL> CONNECT SYS/sys_password as SYSDBA
SQL> SHUTDOWN NORMAL
Enter the following commands to start the instance:
$ sqlplus /nolog
@mmaha
mmaha / gist:1402398
Created November 28, 2011 22:34
Oracle Identity and Access Management API Documentation
@mmaha
mmaha / gist:1472598
Created December 13, 2011 15:45
xargs with multiple commands
ls *.wlst | xargs -I{} -n 1 sh -c "echo '--- {} ---'; cat {}"
connect('weblogic', 'Abcd1234', 't3://localhost:7001')
listLoggers(pattern="oracle.oam.*", target="oam_server1")
exit()
@mmaha
mmaha / findWLSServers.sh
Created January 11, 2012 15:14
Find what weblogic servers are running
#!/bin/sh
ps -ef | grep "weblogic\.Name" | sed 's/.*weblogic\.Name=//g' | cut -d ' ' -f 1