<commit_before>#!/bin/bash

###############################################################################
# @Author : <NAME> aka Lightuono / Toshidex
# @Implemented by : <NAME> aka DLion
# @Name : Defollow Notify
# @Copyright : 2012
# @Site : http://www.toshidex.org
# @Site : http://about.me/dlion
# @License : GNU AGPL v3 http://www.gnu.org/licenses/agpl.html
###############################################################################

DFN_RC="/usr/local/src/defollownotify/defollownotify.rc"
OAuth_sh=$(which TwitterOAuth.sh)
HOME_IDS="$HOME/.defollownotify"
screen_name=()

(( $? != 0 )) && echo 'Unable to locate TwitterOAuth.sh! Make sure it is in searching PATH.' && exit 1
source "$OAuth_sh"


usage(){

	cat << "USAGE"
        
Use: defollownotify [OPTION]
        
   -B      Enable Bastard Mode - Notification via Twitter

   -v	   Print Version
USAGE

}


load_config() {
	
	[[ ! -d "$HOME/.defollownotify" ]] && mkdir $HOME/.defollownotify
	
	[[ -f "$DFN_RC" ]] && . "$DFN_RC" || echo -e "\n defollownotify.rc: File not found!\n $(exit)"
	
	[[ "$oauth_consumer_key" == "" ]] && echo -e "\n The variable [ oauth_consumer_key ] not found!\n" && exit 1
        [[ "$oauth_consumer_secret" == "" ]] && echo -e "\n The variable [ oauth_consumer_secret ] not found!\n" && exit 1
	[[ "$USER_NAME" == "" ]] && echo -e "\n You have not insert an account Twitter!\n" && exit 1
	[[ ! ("$BASTARD_MODE" == "TRUE" || "$BASTARD_MODE" == "FALSE") ]] && echo -e "\n You have not insert an value BOOLEAN (TRUE|FALSE)!\n" && exit 1

	TO_init

	if [[ "$oauth_token" == "" ]] || [[ "$oauth_token_secret" == "" ]]; then
		TO_access_token_helper
		if (( $? == 0 )); then
			oauth_token=${TO_ret[0]}
			oauth_token_secret=${TO_ret[1]}
			echo "oauth_token='${TO_ret[0]}'" >> "$DFN_RC"
			echo "oauth_token_secret='${TO_ret[1]}'" >> "$DFN_RC"
			echo "Token saved."
		else
			echo 'Unable to get access token'
			exit 1
		fi
	fi
}

print_error() {


	[[ ! -z $1 ]] && echo -e "\e[0;1;31m\n*ERROR:$error\e[m\n" && exit 1
}

convert_ids() {

	name=$(curl -s "https://api.twitter.com/1/users/show.xml?user_id=$1" | grep "<screen_name>" | sed -e 's/<screen_name>//g' -e 's/<\/scre.*//g' -e 's/  //g')
	if [[ "$name" == "" ]]; then
		echo -e "\e[0;1;34mUser [\e[m\e[0;1;31m $1 \e[m\e[0;1;34m] not found.\n\e[m" 
		return<commit_msg>Add an usage line for use uninstall<commit_after>#!/bin/bash

###############################################################################
# @Author : <NAME> aka Lightuono / Toshidex
# @Implemented by : <NAME> aka DLion
# @Name : Defollow Notify
# @Copyright : 2012
# @Site : http://www.toshidex.org
# @Site : http://about.me/dlion
# @License : GNU AGPL v3 http://www.gnu.org/licenses/agpl.html
###############################################################################

DFN_RC="/usr/local/src/defollownotify/defollownotify.rc"
OAuth_sh=$(which TwitterOAuth.sh)
HOME_IDS="$HOME/.defollownotify"
screen_name=()

(( $? != 0 )) && echo 'Unable to locate TwitterOAuth.sh! Make sure it is in searching PATH.' && exit 1
source "$OAuth_sh"


usage(){

	cat << "USAGE"
        
Use: defollownotify [OPTION]
        
   -B      Enable Bastard Mode - Notification via Twitter

   -v	   Print Version

* If you want uninstall defollownotify you have to run /usr/local/src/defollownotify/uninstall.sh
USAGE

}


load_config() {
	
	[[ ! -d "$HOME/.defollownotify" ]] && mkdir $HOME/.defollownotify
	
	[[ -f "$DFN_RC" ]] && . "$DFN_RC" || echo -e "\n defollownotify.rc: File not found!\n $(exit)"
	
	[[ "$oauth_consumer_key" == "" ]] && echo -e "\n The variable [ oauth_consumer_key ] not found!\n" && exit 1
        [[ "$oauth_consumer_secret" == "" ]] && echo -e "\n The variable [ oauth_consumer_secret ] not found!\n" && exit 1
	[[ "$USER_NAME" == "" ]] && echo -e "\n You have not insert an account Twitter!\n" && exit 1
	[[ ! ("$BASTARD_MODE" == "TRUE" || "$BASTARD_MODE" == "FALSE") ]] && echo -e "\n You have not insert an value BOOLEAN (TRUE|FALSE)!\n" && exit 1

	TO_init

	if [[ "$oauth_token" == "" ]] || [[ "$oauth_token_secret" == "" ]]; then
		TO_access_token_helper
		if (( $? == 0 )); then
			oauth_token=${TO_ret[0]}
			oauth_token_secret=${TO_ret[1]}
			echo "oauth_token='${TO_ret[0]}'" >> "$DFN_RC"
			echo "oauth_token_secret='${TO_ret[1]}'" >> "$DFN_RC"
			echo "Token saved."
		else
			echo 'Unable to get access token'
			exit 1
		fi
    fi
}

print_error() {

	[[ ! -z $1 ]] && echo -e "\e[0;1;31m\n*ERROR:$error\e[m\n" && exit 1
}

convert_ids() {

	name=$(curl -s "https://api.twitter.com/1/users/show.xml?user_id=$1" | grep "<screen_name>" | sed -e 's/<screen_name>//g' -e 's/<\/scre.*//g' -e 's/  //g')
	if [[ "$name" == "" ]]; then
		echo -e "\e[0;1;34mUser [\e[m\e[0;1;31m $1 \e[m\e[0;1;34m] not found.\n\e[m" 
		return
{'fraction_non_alphanumeric': 0.2603314453534718, 'fraction_numerical': 0.01594294105307321, 'mean_word_length': 3.6699314397649365, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2185862', 'n_tokens_mistral': 1939, 'n_tokens_neox': 1805, 'n_words': 409}