This file contains hidden or 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 | |
# ALIASES | |
alias editbash='vim ~/.bashrc' | |
alias updatebash='source ~/.bashrc' | |
alias rm='rm -i' | |
alias cp='cp -i' | |
alias mv='mv -i' | |
alias shutdown='shutdown -P now' |
This file contains hidden or 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
<?php | |
// SET YOUR USER/PASS STUFF HERE... | |
$auth = array( | |
'user1' => 'pass123', | |
'user2' => 'pass123', | |
'user3' => 'pass123', | |
'user4' => 'pass123', | |
'user5' => 'pass123', | |
); | |
This file contains hidden or 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
# Install Something (duh...) | |
apt-get install {package name} | |
# Search for Package in Repos | |
apt-cache search | |
# Get Package Info In Detail (including version) | |
apt-cache show {package name} | |
# Remove a Package |
This file contains hidden or 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
# Install NPM Module Globally | |
sudo npm install -g {module name} | |
# example | |
sudo npm install -g connect |
This file contains hidden or 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
# Shows you where the app is coming from | |
which {app} | |
# Example... | |
which java | |
# returns: /usr/bin/java |
This file contains hidden or 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
/** | |
* Is Date A Business Day? | |
* @param cal | |
* @return boolean | |
*/ | |
public boolean isBusinessDay(Calendar cal){ | |
// check if weekend | |
if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){ | |
return false; | |
} |
This file contains hidden or 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
System.out.println("##################\n Relevant Stack\n##################"); | |
for(StackTraceElement stackelement : Thread.currentThread().getStackTrace()){ | |
String[] elementClass = stackelement.getClassName().split("\\."); | |
// Set Relevant Packages Here (com by default) | |
if( elementClass.length > 3 && elementClass[0].equals("com") ) { | |
System.out.println( stackelement.getClassName() + " :: " + stackelement.getMethodName() + "()"); | |
} | |
} | |
System.out.println("##################\n [end] Relevant Stack\n##################\n\n"); |
This file contains hidden or 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
######################################################### | |
# Step 1 - Create /etc/init.d/{service-name} File | |
######################################################### | |
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: service-name | |
# Short-Description: Management of {Service Name} | |
### END INIT INFO | |
This file contains hidden or 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
// Array of StackTraceElements | |
Thread.currentThread().getStackTrace(); | |
// Return as String, (Uses Apache Commons Lib) | |
String fullStackTrace = org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(e); | |
// Get Defined Position of Current Method | |
(new Throwable()).getStackTrace(); |
This file contains hidden or 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
/* | |
* Implement the java.lang.Iterable<E> interface | |
*/ | |
public class MyCollection<E> implements Iterable<E>{ | |
public Iterator<E> iterator() { | |
return new MyIterator<E>(); | |
} | |
} |