Skip to content

Instantly share code, notes, and snippets.

View bijanebrahimi's full-sized avatar

bijan bijanebrahimi

View GitHub Profile
@bijanebrahimi
bijanebrahimi / geoformatter.sh
Created September 10, 2014 16:40
Geolocation meta data convertor (degree to decimal)
#!/bin/bash
# Geolocation meta data convertor (degree to decimal)
# Authur: Bijan Ebrahimi
# License: GPL v3.0 or any later
if [ ! "$#" == "1" ]; then
echo "Manual: `basename $0` JPG_FILE"
exit 1
fi
@bijanebrahimi
bijanebrahimi / tci-bandwith
Created August 1, 2014 20:46
‫نمایش باقیمانده ترافیک مشترکان ADSL مخابرات
#!/usr/bin/env python2.7
# Author: Bijan EBrahimi [dev-null@riseup.net]
# License: GPL 3 or later
# Published: Sat Aug 2 01:11:11 IRDT 2014
#
# Python Script to Bypass Captcha at Login page of TCI ADSL Provider
# to show remaining bandwidth.
# With Special thanks to @shabgard
#
# Dependencies:
@bijanebrahimi
bijanebrahimi / Get SoundCloud
Created April 7, 2014 17:33
Download SoundCloud Music from terminal
#!/bin/bash
#
# GetSoundcloud
#
# Copyright: 2014 Bijan Ebrahimi <bijanebrahimi@riseup.net>
#
# You may distribute this file under the terms of the GNU General
# Public License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
@bijanebrahimi
bijanebrahimi / awesome-volume.sh
Last active December 29, 2015 15:09
AwesomeWM Progressbar Volume Changer
#!/bin/bash
STEP="10"
UNIT="%"
SETVOL="/usr/bin/amixer -q sset Master"
STATE=$(amixer get Master | grep Left | egrep 'Playback.*?\[o' | egrep -o '\[o.+\]')
case "$1" in
"up")
#!/bin/bash
echo "<?php"
curl -s http://www.nnvv.org/ | grep -m 2 -o "\(Password\|Username\):[a-zA-Z0-9\-]\+" | while read line; do
echo $line | sed 's/Username/\$user/' | sed 's/Password/\$pass/' | sed 's/:\(.*\)$/="\1";/'
done
echo "?>"
@bijanebrahimi
bijanebrahimi / certcheck
Created August 9, 2013 21:09
Check certification fingerprints using openssl in bash
#!/bin/sh
#
# usage: certcheck hostname [port]
#
REMHOST=$1
REMPORT=${2:-443}
echo |\
openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |\
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | openssl x509 -sha1 -noout -fingerprint
#!/bin/bash
for i in `seq 1 42`; do
echo "retreiving page $i"
page_content=$(wget -q -O - "$@" http://iconmonstr.com/page/$i/)
echo ${page_content/$'\n'/} | grep -o "<svg [^>]*> <path [^>]*>" | while read svg; do
file_name=$(echo $svg | grep -o "id=\"[^\"]*\"" | sed 's/id="//' | sed 's/"//')
echo -en " ${file_name}.svg\t"
cat > ${file_name}.svg << EOF
<?xml version="1.0" encoding="utf-8"?>
#!/bin/bash
TMP_FILE="/tmp/election"
wget -qO- http://election.farsnews.com/electioninfo.js | sed 's/var //' | sed 's/ = /=/' | sed "s/\[/\(/" | sed "s/\]/\)/" > $TMP_FILE
source "$TMP_FILE"
echo "last Update: "${categoryarray[${#categoryarray[@]}-1]}
echo "$lastTotal ($lastCounted, $lastFailed)"
echo "%"$(echo "scale = 4; ($lastRohani / $lastTotal) * 100" | bc 2>/dev/null)" Rohani with $lastRohani votes"
echo "%"$(echo "scale = 4; ($lastQalibaf / $lastTotal) * 100" | bc 2>/dev/null)" Qalibaf with $lastQalibaf votes"
#!/bin/bash
TMP_FILE="/tmp/election"
wget -q http://election.farsnews.com/electioninfo.js -O $TMP_FILE
TOTAL=$(cat $TMP_FILE | grep -o "lastTotal = [0-9]\+" | sed "s/lastTotal = //" | sed "s/;//")
COUNTED=$(cat $TMP_FILE | grep -o "lastCounted = [0-9]\+" | sed "s/lastCounted = //" | sed "s/;//")
FAILED=$(cat $TMP_FILE | grep -o "lastFailed = [0-9]\+" | sed "s/lastFailed = //" | sed "s/;//")
UPDATE=$( cat $TMP_FILE | grep "categoryarray" | grep -o "[0-9:]\{5\}']" | sed "s/']//")