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 / spf13-setup.sh
Last active August 29, 2015 13:55
spf13-vm installation and customization
#Setup spf13-vim
# Assumes MacOS has homebrew install
# Assumes Linux is Debian based
#Install spf13-vim
curl http://j.mp/spf13-vim3 -L -o - | sh
if [ "$(uname)" = "Darwin" ]; then
brew install ctags
elif [ "$(uname)" = "Linux" ]; then
@alghanmi
alghanmi / cs103-upgrade-vm.sh
Last active August 29, 2015 13:55
Update CSCI 103 VM to 104 Standards
#!/bin/bash
## Check if g++-4.8 is installed
_GPP_PREF_VER="4.8"
_GPP_LOC="$(readlink -f $(which g++))"
_GPP_VER="$(g++ --version | head -1 | sed 's/g++ \(.*\) \(.*\)/\2/' - | cut -d. -f1,2)"
if [ "$_GPP_LOC" == "/usr/bin/g++-$_GPP_PREF_VER" ]; then
if [ "$_GPP_VER" != "$_GPP_PREF_VER" ]; then
echo "Please contact your TA and inform them that you have g++-$_GPP_PREF_VER installed, but it is not the default g++ on your system"
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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"