Skip to content

Instantly share code, notes, and snippets.

View greyaperez's full-sized avatar

Grey Perez greyaperez

View GitHub Profile
@greyaperez
greyaperez / isBusinessDay.java
Last active April 21, 2023 08:42
Function to Check Whether Date is a Business Day or Not (ex: Weekend or Holiday)
/**
* 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;
}
@greyaperez
greyaperez / path_of_app_binary.sh
Created March 16, 2014 21:44
Find where the bin of an app is located
# Shows you where the app is coming from
which {app}
# Example...
which java
# returns: /usr/bin/java
@greyaperez
greyaperez / install_npm_module_globally.sh
Created March 16, 2014 22:04
Install NPM Module Globally... avoid headache
# Install NPM Module Globally
sudo npm install -g {module name}
# example
sudo npm install -g connect
@greyaperez
greyaperez / apt-get-common.sh
Created March 17, 2014 04:02
Common & Useful apt-get/apt-cache commands
# 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
@greyaperez
greyaperez / quick_and_dirty_login.php
Created March 21, 2014 14:16
Very quick and dirty login, just add this entire script above the stuff in your index.php file.
<?php
// SET YOUR USER/PASS STUFF HERE...
$auth = array(
'user1' => 'pass123',
'user2' => 'pass123',
'user3' => 'pass123',
'user4' => 'pass123',
'user5' => 'pass123',
);
#!/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'
# Just Change the port or hostname as needed
curl -IL http://localhost:8080
@greyaperez
greyaperez / exclude_filter.sh
Created April 14, 2014 20:45
Exclude Filter
function not(){
grep -v $1
}
#usage
find . -name something* | not somethingelse
@greyaperez
greyaperez / get_time_ms.js
Created April 23, 2014 19:33
Prints Time including milliseconds
new Date / 1000
@greyaperez
greyaperez / restore_console.log.js
Created May 2, 2014 17:46
Restores console.log() if undefined or set to null.
// Restores Native console.log()
delete console.log