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 / import_git2git.sh
Last active January 6, 2020 06:48
Import an existing git repository (A) into another (B)
#!/bin/sh
##
## Import an existing git repository (A) into another (B)
##
## Reference: http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
##
REPO_A="<git repo A url>"
REPO_A_DIR="<directory 1>"
@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 / google-authenticator.sh
Created July 28, 2013 12:53
Setup Google Authenticator on OpenVPN
sudo aptitude install libpam0g-dev
git clone https://code.google.com/p/google-authenticator/
cd google-authenticator/libpam/
make
sudo make install
google-authenticator
sudo cp /etc/pam.d/common-account /etc/pam.d/openvpn
@alghanmi
alghanmi / clawbotiq_joystick.c
Last active April 12, 2018 20:11
Clawbot IQ Joystick sample program
#pragma config(Motor, port1, leftMotor, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port6, clawMotor, tmotorVex269, openLoop, reversed)
#pragma config(Motor, port7, armMotor, tmotorVex393, openLoop, reversed)
#pragma config(Motor, port10, rightMotor, tmotorVex393, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main ()
{
@alghanmi
alghanmi / install_git_on_parallel.sh
Created April 25, 2012 07:24 — forked from ad510/install_git_on_parallel.sh
shell script to install Git on USC parallel computers without root permissions
# note that this file needs execute permissions to run, which can be done by running "chmod u+rwx ./install_git_on_parallel.sh" (without quotes)
# this script based on:
# http://joemaller.com/908/how-to-install-git-on-a-shared-host/
# http://stackoverflow.com/questions/9500898/compiler-error-msgfmt-command-not-found-when-compiling-git-on-a-shared-hosting
# update $PATH
echo "# the following two lines added by install_git_on_parallel.sh" >> ~/.bashrc
echo "export PATH=$HOME/opt/bin:$PATH" >> ~/.bashrc
echo ". $HOME/opt/contrib/completion/git-completion.bash" >> ~/.bashrc
. ~/.bashrc
$ st2 run core.remote hosts=100.73.114.124 whoami
.
id: 56847659a8479506930a36d7
status: failed
parameters:
cmd: whoami
hosts: 100.73.114.124
result:
error: "Unable to connect to any one of the hosts: [u'100.73.114.124'].
@alghanmi
alghanmi / ansible.cfg
Last active April 8, 2018 01:55
Ansible OpenStack Test
[defaults]
inventory = hosts
log_path = logs/ansible.log
host_key_checking = no
record_host_keys = no
ssh_args = -o ControlMaster=auto -o ControlPersist=30m
gather_facts = smart
library = /opt/ansible/lib:
@alghanmi
alghanmi / dirmngr.conf
Created August 1, 2017 02:42
GPG Config
keyserver hkps://hkps.pool.sks-keyservers.net
@alghanmi
alghanmi / vps_prep.sh
Last active April 8, 2018 01:55
Prepare a Debian VPS for Ansible Run
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# Set User information
export _USER="rami"
export _NAME="Rami AlGhanmi"
@alghanmi
alghanmi / macos_iso_to_usb.sh
Created April 8, 2016 04:55
Create a USB drive from ISO image on Mac
# Convert ISO to IMG format
hdiutil convert -format UDRW -o iso-image.img iso-image.iso
# Find USB Drive number N
diskutil list
diskutil unmountDisk /dev/diskN
# Write image to drive /dev/diskN where N is the disk number
sudo dd if=iso-image.img.dmg of=/dev/diskN