Skip to content

Instantly share code, notes, and snippets.

View alghanmi's full-sized avatar

Rami AlGhanmi alghanmi

  • University of Southern California
  • Los Angeles, CA
View GitHub Profile
@alghanmi
alghanmi / smiley_paran.py
Created September 26, 2013 03:26
Paran Matcher that accepts smileys
def paran_check(expression):
#print expression
index = 0
#calculate '(' ')' index
for c in expression:
if c == '(':
index = index + 1
elif c == ')':
index = index - 1
@alghanmi
alghanmi / HelloWorld.java
Created September 30, 2013 01:10
Bad Hello World Example
/*
Hello World example
*/
*/
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hi World!");
}
@alghanmi
alghanmi / bashrc_additions.sh
Last active December 26, 2015 04:39
VPS Basic Account Setup
##
## User Modifications
##
#Set Default Editor
EDITOR=vim
##XTERM modifications (in case needed)
#export TERM="xterm-256color"
@alghanmi
alghanmi / dot.gitignore
Last active December 26, 2015 04:48
Sample .gitignore file
##Editor Temporary Files
.*.sw[a-z]
*~
\#*\#
##Compiled source
*.class
*.o
*.so
*.pyc
@alghanmi
alghanmi / vps_account_setup.sh
Last active December 26, 2015 05:08
Basic VPS Account Setup
##
## Setup Env Variables
##
GIT_USERNAME=""
GIT_EMAIL=""
GIT_EDITOR=vim
SSH_KEY_COMMENT="$USER@$(hostname -f)"
SSH_KEY_SIZE=4096
@alghanmi
alghanmi / FizzBuzz_1.cpp
Last active December 26, 2015 20:49
FizzBuzz git Merge Exercise
#include <iostream>
int main(int argc, char *argv[]) {
for(unsigned int i = 0; i < 100; i++) {
std::cout << i << std::endl;
}
return(0);
}
@alghanmi
alghanmi / ProducerConsumer2.java
Created October 31, 2013 05:58
Producer Consumer Shared Data Model for CSCI 201
/*
* Figure 2-27
* Main Class which uses the ProducerConsumerMonitor
*/
import ProducerConsumerMonitor;
import Item;
class ProducerConsumer2 extends Thread {
@alghanmi
alghanmi / PropertiesDemo.java
Created November 20, 2013 09:04
Java Properties Files
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
public class PropertiesDemo {
PropertiesDemo() {
}
//Print Properties
@alghanmi
alghanmi / listdiff.py
Created January 20, 2014 18:25
List Diff - A Doff Tool for Lists. Perform a diff between a pair of lists.
"""List Diff - A Doff Tool for Lists
Perform a diff between a pair of lists.
Usage:
listdiff.py <file1> <file2>
listdiff.py -h | --help
listdiff.py --version
Arguments:
@alghanmi
alghanmi / bash_profile.sh
Last active January 4, 2016 07:19
MacOS Bash Profile
#Enable terminal colors
export TERM=xterm-color
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
#PS1='\[\033[0;33m\]\u\[\033[0m\]@\[\033[0;32m\]\h\[\033[0m\]:\[\033[0;34m\]\w\[\033[0m\]\$ '
PS1='\[\033[0;33m\]\u\[\033[0m\]@\[\033[0;32m\]\h\[\033[0m\]:\[\033[0;34m\]\w\[\033[0;036m\]$(__git_ps1 " (%s)") \[\033[0m\]\$ '
#Load Profile
if [ -f ~/.profile ]; then
. ~/.profile