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 / wps_openwrt.sh
Last active January 28, 2021 00:47
WPS on OpenWRT -- Enabling Wi-Fi Protected Setup on OpenWRT
##
## WPS on OpenWRT
## This script enables Wi-Fi Protected Setup on OpenWRT.
##
## Resources
## http://wiki.openwrt.org/doc/uci/wireless#wps.options
##
#Install the full wpad package
opkg update
@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 / curl_example.cpp
Created May 5, 2014 20:12
cURL C++ Example
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
@alghanmi
alghanmi / OverDriveMediaConsole.md
Last active October 17, 2023 00:02
Install OverDrive Media Console on Linux

##OverDrive Media Console OverDrive is a very common provider for eBooks and Audiobooks for the many public libraries. The ODMC is the application used to download resources.

OD now supports MP3 for all its audio-books and epub for their ebooks. This allows you to use it on Linux.

##Install and Setup ###Step 1. Dependencies To use ODMC on Linux, you need to install wine and winetricks. On a debian-based system, you can do:

sudo aptitude install wine winetricks
@alghanmi
alghanmi / podcastgen.py
Last active October 18, 2023 21:49
Podcast Feed Generator -- Generate an podcast RSS feed for a set of media in a directory.
"""Podcast Feed Generator
Generate an podcast RSS feed for a set of media in a directory.
Use the list-extensions argument to see the list of supported extensions. You can add custom extensions using
Usage:
podcastgen.py gen <directory> --title=<podcast-title> --link=<podcast-link> --desc=<description> [--output=<rss-feed-file>] [--feed-link=<feed-url>] [--id=<podcast-id>] [--logo=<image_file>] [--category=<itunes-category> [--subcategory=<itunes-category>]] [--language=<language>] [--use-extension=<ext>]
podcastgen.py list-categories
podcastgen.py list-extensions
podcastgen.py -h | --help
@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 / usclug-vm.sh
Last active August 29, 2015 13:57
USCLUG VM Generation Script for Workshops
SCRIPT_USERNAME="usclug"
SCRIPT_USERHOME="/home/$SCRIPT_USERNAME"
echo "**"
echo "** System Setup"
echo "**"
cp /etc/apt/sources.list /etc/apt/sources.list.default
echo "deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free" | tee /etc/apt/sources.list
echo "deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free" | tee -a /etc/apt/sources.list
echo "" | tee -a /etc/apt/sources.list
@alghanmi
alghanmi / bitlbee-init.sh
Last active November 27, 2018 22:42
init scripts for IRC services as daemon -- znc and Bitlbee
#! /bin/sh
### BEGIN INIT INFO
# Provides: bitlbee
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Bitlbee IRC to other chat networks gateway
### END INIT INFO
@alghanmi
alghanmi / batch-rename.sh
Created February 9, 2014 18:01
Rename a set of files in a directory
#!/bin/bash
#
# Batch rename assignment submission files.
# Input format: PA1 Submission_username_attempt_2014-02-06-14-05-19_tp.cpp.zip
# Output format: pa1_username.zip
# Accepted file formats: zip and gz
#
USAGE_MESSAGE="Perform a batch rename or all submission files in a directory.
@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"