Skip to content

Instantly share code, notes, and snippets.

View amboxer21's full-sized avatar

Anthony Guevara amboxer21

  • Brick, New Jersey 08723
View GitHub Profile
@amboxer21
amboxer21 / killall2
Created November 2, 2012 05:01
A refined killall command for Arch. Since killall doesn't properly work for me.
#!/bin/bash
if (( $# != 1 )) ; then
echo -e "USAGE: $0 program";
fi
# For use with Debian
# Instead use -> exists=$(dpkg -s $1 | awk -F: '/Package:/{print $2}' | sed 's/^[ \t]*//');
exists=$(pacman -Q $1 | awk '{ print $1}');
@amboxer21
amboxer21 / video2mp3 bash
Created November 2, 2012 07:06
Extract audio from a video file
#!/bin/bash
if (( $# != 3 )) ; then echo -e "USAGE: infile.avi outfile title"; exit; fi
ffmpeg -i $1 -acodec libmp3lame -metadata TITLE="$3" ${2}.mp3
@amboxer21
amboxer21 / SysRemountRW.sh
Created January 19, 2014 21:49
Remounts android FS as read/write.
#!/bin/sh
if mount | grep "system*.*ro"; then
echo -e "\nRemounting system as R/W.\n" &&
mount -o remount,rw $(mount | awk '/system/ {print $1}' | sed 's/\/system/ \/system/g';
else
echo -e "\nSystem is already mounted as R/W.\n";
fi
@amboxer21
amboxer21 / ifconfig.sh
Created January 26, 2015 15:25
Bash script to monitor wireless card overruns for incrementing values
#!/bin/bash
#
# Grabs each iface and its respective overruns variables, ties them all together
# and pushes them into the res variable. Resulting in a line for every iface.
res=$(readarray -t mon < <(cat ifconfig | \
awk '/w[a-z]*[0-9]/,/TX.*overruns:[0-9]/{print}'); echo "${mon[@]}" | \
egrep -o "(w[a-z]*[0-9]|overruns:[0-9]{1,99})" | \
sed -e 'N;N;s/\n/ /g');
readarray -t fin < <(echo "$res");
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/
@amboxer21
amboxer21 / enable_cnam
Created February 25, 2015 21:51
Enable cnam on all outbound numbers for dynamic bandwith
mcl plex0spa
mcl> rtrv-route-digits::MTT-CDPN-NATNUM-73278424;
#save rd_73278424
cat rd_73278424 | grep -o "MTT-CDPN-NATNUM-[0-9]\{10\}:RTDEST=RTLIST-VOIP" | sed -e 's/MTT-CDPN-NATNUM-[0-9]\{10\}:RTDEST=RTLIST-VOIP/ED-ROUTE-DIGITS::&_CNAM;/g;s/:RTDEST/:::RTDEST/g'
The above can be used in place of any number.
@amboxer21
amboxer21 / ivad_driver.rb
Created February 26, 2015 21:32
mtt3 program that is responsible for handling forwards
#!/usr/bin/ruby
#
# ivad_driver.rb is closely related to the rails application
# located at https://mtt4.monmouth.com/ivad.
# ivad_driver.rb's job is to read the pending operations from the database
# (that the web app writes to) and perform the modification on the necessary
# equipment as well as update the callerid and whodunit tables
require "/etc/ivad/ivad_rails_env_config"
require 'ivad/simple_factory'
$ irb -r ./select_server
>> client.puts "hi"
=> nil
>> client.puts "bye"
=> nil
>> client.close
=> nil
>> exit
@amboxer21
amboxer21 / ifconfig.txt
Created March 4, 2015 14:39
Test file for ifconfig.rb
eth0 Link encap:Ethernet HWaddr 78:24:af:6e:a6:60
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
#!/bin/bash
mkv=$1
if [[ ! -e $mkv ]]; then
echo -e "No such file or directory.\n";
exit;
elif [[ $mkv == `echo $mkv | egrep "/"` ]]; then
parsed_name=$(echo $mkv | awk '{gsub(/\//, " "); print $NF}');
parsed_path=$(echo $mkv | sed 's/\(\/.*\/\)\(.*$\)/\1/g');