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
#!/bin/bash
##
## Download the RSS feed of a podcast
## Args: $1 -- destination file
## $2 -- URL for podcast feed
## TODO:
## - validate parameters
## - ensure log location exists
@alghanmi
alghanmi / Makefile
Created June 11, 2014 23:53
Sample Makefile for CS 104 homework question
IDIR =.
CC=g++
CFLAGS=-I$(IDIR) -std=c++11 -ggdb
ODIR=.
LDIR =../lib
LIBS=-lm
_DEPS = shape.h
@alghanmi
alghanmi / gcc-default-fix.sh
Last active May 11, 2017 08:37
Change the default g++ compiler on MacOS to be the brew version
#
# Make gcc-4.8 the default compiler
# brew installs gcc-4.8, but does not create symlinks for it to be used
# without the version number.
# This script:
# 1. Generate symlinks for all gcc tools installed by brew
# 2. Make brew-installed software the first in path
#
BREW_CMD="brew"
@alghanmi
alghanmi / gtest_install.sh
Last active March 6, 2017 21:21
Install Google C++ Testing Framework. This script works for both MacOS and Linux
##
## Install Google C++ Testing Framework
##
##Remove Libraries that are already installed
# Linux:
# sudo rm -rf /usr/local/opt/gtest*
# sudo libtool --mode=uninstall rm /usr/local/lib/libgtest.a
# sudo libtool --mode=uninstall rm /usr/local/lib/libgtest_main.a
@alghanmi
alghanmi / deluge-daemon_init.sh
Last active February 5, 2016 07:29
Deluge init script taken from the Deluge User Guide. Note that references to deluge web are removed. http://dev.deluge-torrent.org/wiki/UserGuide/InitScript/Ubuntu
#!/bin/sh
### BEGIN INIT INFO
# Provides: deluge-daemon
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Daemonized version of deluge and webui.
@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);
}