I think we all agree…



UPDATED! (04082012)
(The main reason: I provided some extra comments in the source.)

That Facebook is a pretty cool social media site..

(It appears that the “ \ ” (this applies mostly to posted sourcecode) gets stripped out by wordpress’ automated ‘spellchecker’!?
Hardcoding the “ \ ” as &#x5c ; seems to solve the problem. 😉 )

But there are a few things I don’t like. For one: the way Facebook handles its outbound links. I.e. I’m used to see the link displayed (on hover) in clear text. But when I choose to copy the link address instead, a feat I often use, I get this junk:

http://www.facebook.com/l.php?u="The urlencoded link"&h=Random-gibberish-etc._et/al

Well I sought to end this madness by writing a little script which removes all the unnecessary junk and gives me back my transparent Internet, the way I like it. So while I can understand why Facebook uses this strategy, for one it’s a nice way to keep track of its users. I feel it interferes too much with the way how I use Facebook.

So here is the script:

strip()
{
## We might not want to run this as root!?
if [ $USER = root ]; then
echo -e ${Red}"\tAre you Insane!\n${Cyan}\tError: In order to use this script, one must NOT be $USER.\n${Yellow}\tExiting..."${Nc}
## The following will kick you out from a 'root-session', i.e. you used 'sudo -s' to become root.
## The '-s' flag implies that you can use (ifdef) your aliases and functions in the new env.
exit 0
else
echo -e ${Blue}"\t${USER} may proceed.\n${Cyan}\tMay peace be with you."${Nc}
fi
clear
## I use the following folder/directory for convenience's sake.
## E.g. the file used by sed is placed here.
if [ ! -d "$HOME/.usr/etc" ];then mkdir -p "$HOME"/.usr/etc;fi
## Let's define the following file then.
sed_txt="$HOME/.usr/etc/sed.txt"
## And create it, if necessary.
if [ ! -f "$sed_txt" ];then
cat >>"$sed_txt"<<_EOF_
s_\(.*\)?url=__
s_\(.*\)&url=__
s_\(.*\)l.php?u=__
s_&domain=\(.*\)__
s_&ei=\(.*\)__
s_\(.*\)&rl=NONE&u=__
s_&rid=\(.*\)__
s_&h=\(.*\)__
s_?fb\_\(.*\)__
s_%20__g
s_%23_#_
s_%26_\&_g
s_%2B_+_
s_%2C_,_g
s_%2F_/_g
s_%3A_:_
s_%3B_;_g
s_%3D_=_g
s_%3F_?_g
s_%5B_[_g
s_%5D_]_g
s_%7B_{_g
s_%7D_}_g
s_\ __g
_EOF_
fi
if [ -z "$1" ];then
echo -e ${Blue}"\t(Hit \"${Yellow}ctrl+shift+v${Blue}\" to paste.)\n"${Nc}
echo -en ${Yellow}"\tPlease enter your url: "${Nc}
read Name
  if [ -z "$Name" ];then echo -e ${Red}"\tPlease provide me with a string to work on."${Nc}
  else 
  [ -n "$Name" ];Name="$Name"
  fi
fi
## If 'Name' is not zero or null then...
if [ -n "$1" ];then Name="$1";fi
## Echo 'Name' to sed and remove the bollocks.
Name=$(echo "$Name" | sed -f "$sed_txt")
## If the links are pasted into a file, then...
## Replace previously mentioned bollocks 'in place' (the '-i' flag)
if [ -f "$1" ];then Name="$1";sed -f "$sed_txt" -i "$1";fi
## I'm only interested in the 'watch?v=blablablala' part,
## when it comes to youtube.
if [ -n "$(echo "$Name" |grep 'youtube')" ];then
echo -e ${Magenta}"\t${Name%%&*}"
## Also interested when it's a link pointing to facebook.
elif [ -n "$(echo "$Name" |grep 'facebook')" ];then
echo -e ${Blue}"\t"$Name""${Nc}
else echo -e ${Cyan}"\t"$Name""${Nc}
fi
}

Usage:

## Usage:
## 'interactive'
# 1.
strip
## paste in url after being prompted.
# 2.
strip 'your.url'
## Don't forget to 'quote' your url.
## Though "..." will work too I recommend you to use '...'
## 'non-interactive'
## You've pasted in a lot of links in somefile.txt and then...
# 3.
strip somefile.txt

For convenience sake I’ve put this one in my ‘$HOME/.bash_functions‘, as evidenced by the screenshots. I’m sharing this with you. Because: You might find it {amusing,useful,helpful,entertaining,*}!? Or because I’m just a nice guy who feels that sharing means caring. 😉

Here are the colors.

## Insert a new line into '$HOME/.bashrc'
echo >> $HOME/.bashrc
## Or simply hit 'ctrl+d' instead of using '<<_EOF_' here.
cat >> $HOME/.bashrc<<_EOF_
# Define some colors first:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
export Black="\033[0;30m"
export Red="\033[0;31m"
export Green="\033[0;32m"
export Yellow="\033[1;33m"
export Blue="\033[1;34m"
export Magenta="\033[1;35m"
export Cyan="\033[1;36m"
export White="\033[1;37m"
export Nc="\033[0m" # No Color
# --> Nice. Has the same effect as using "ansi.sys" in DOS.
_EOF_

And here’s once again the how to enable the ‘$HOME/.bash_functions‘ thingy.

## Insert a new line into '$HOME/.bashrc'
echo >> $HOME/.bashrc
## Or simply hit 'ctrl+d' instead of using '<<_EOF_' here.
## The following will enable to use the function as described below.
cat >> $HOME/.bashrc<<_EOF_
# Functions: check for a separate function file, and if we find one
# source it.
if [ -f ~/.bash_functions ]; then
    . ~/.bash_functions
fi
_EOF_

Anyway!

Examples:

“Interactively”

http://www.mixcloud.com/DJSe7en/dj-se7en-mix-the-planet-vol15/


(As taken just this evening from facebook and added a few extras today.)
(24032012)
Before:

http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.playboymisssocial.com%2F&h=RAQFvsC_-AQFRx55SPqil_JYHPWEW4nytMsksW3fOFX0Ypg
http://www.facebook.com/l.php?u=http%3A%2F%2Fow.ly%2F9PP0F&h=kAQEiTaSGAQG02htRNOvwQocRMZqb6Lvvw21eTTFSGUd8XA
http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhDHSKcmVV68&h=yAQFKRwBG
http://www.facebook.com/l.php?u=http%3A%2F%2Fyoutu.be%2FDbB1xCF0YOw&h=_AQHBSUYyAQG7l3donnX4LDeIAxtXDT-bRqSkCtpjmHbrww
http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKU194KNl1II&h=_AQHBSUYyAQHf7mlqIUoTQlACI-jW9U4fz_7K-7RizSVquw
http://www.facebook.com/l.php?u=http%3A%2F%2Floudwire.com%2Fmarch-metal-madness-devil-horn-region-round-2%2F&h=yAQFKRwBGAQEhb5YfMtp7t_20knbYQCmBIiqgyeEha-jEww
http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.globalresearch.ca%2Findex.php%3Fcontext%3Dva%26aid%3D29835&h=-AQEk02rLAQGHTETth6he4NRwboeWSKY0vnxIiLQgCMdevg
http://www.google.nl/url?sa=t&rct=j&q=police%20state%20usa%3A%20new%20obama%20executive%20order%20seizes%20u.s.%20infrastructure%20and%20citizens%20for%20military%20preparedness&source=web&cd=4&ved=0CD0QFjAD&url=http%3A%2F%2Fbreakthematrix.com%2Fenergy%2Fobama-executive-order-seizes-infrastructure-citizens-military-preparedness%2F&ei=eKVtT7WaG4ntOajVkfYF&usg=AFQjCNEatlPmGYQvhkHn7s7z8n2fhZTLaQ
http://www.google.nl/url?sa=t&rct=j&q=police%20state%20usa%3A%20new%20obama%20executive%20order%20seizes%20u.s.%20infrastructure%20and%20citizens%20for%20military%20preparedness&source=web&cd=5&ved=0CEMQFjAE&url=http%3A%2F%2Fozhouse.org%2F2012%2F03%2F20%2Fnew-obama-executive-order-seizes-u-s-infrastructure-and-citizens-for-military-preparedness%2F&ei=eKVtT7WaG4ntOajVkfYF&usg=AFQjCNHJNmUjLJPxB6HtqL4uepb7vxlzEg
https://encrypted.google.com/url?sa=t&rct=j&q=police%20state%20usa%3A%20new%20obama%20executive%20order%20seizes%20u.s.%20infrastructure%20and%20citizens%20for%20military%20preparedness&source=web&cd=3&ved=0CDUQFjAC&url=http%3A%2F%2Fwww.infowars.com%2Fnew-obama-executive-order-seizes-u-s-infrastructure-and-citizens-for-military-preparedness%2F&ei=q6VtT9ZDgoQ6j67p-wU&usg=AFQjCNFqlF-CwBgp8ei2IBmZSE13oATJPA

Now run the sed function as described up above.

Et voila, c’est tout. 😉:

http://www.playboymisssocial.com/
http://ow.ly/9PP0F



http://loudwire.com/march-metal-madness-devil-horn-region-round-2/
http://www.globalresearch.ca/index.php?context=va&aid=29835
http://breakthematrix.com/energy/obama-executive-order-seizes-infrastructure-citizens-military-preparedness/
http://ozhouse.org/2012/03/20/new-obama-executive-order-seizes-u-s-infrastructure-and-citizens-for-military-preparedness/
http://www.infowars.com/new-obama-executive-order-seizes-u-s-infrastructure-and-citizens-for-military-preparedness/

Now how to make scripts executable in Ubuntu.

And for the astute reader: Yes I write my posts and comments in a text-editor before I publish them on Facebook, because this has at least two major benefits.
1. I’ve got spell check enabled. 😉 I know many English words by heart sure, but a ‘failsafe’ like this comes in quite handy.
2. I can order and format my text more properly!!!


Kindest regards,

Alex

ღ Ƹ̵̡ Ӝ̵̨̄ Ʒ ☆ ˜ ” * ° • . ¸ł¸ . • ° * ” ☆ ★ ☆ ę ˜

♫ d(。◕‿◕。)b ♪♪

Use the contact-form below, for feedback purposes.







Back to top.

One thought on “I think we all agree…

Comments are closed.