<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Me &#8211; Scott Mcintyre</title>
	<atom:link href="https://scott.cm/category/me/feed/" rel="self" type="application/rss+xml" />
	<link>https://scott.cm</link>
	<description>Web Operations Engineer,  Linux Systems Administrator,  mySQL DBA,  MongoDB DBA,  Python+PHP Developer,  Performance Engineer</description>
	<lastBuildDate>Mon, 16 Apr 2012 21:40:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.2.2</generator>
	<item>
		<title>Learning Python</title>
		<link>https://scott.cm/learning_python/</link>
				<comments>https://scott.cm/learning_python/#respond</comments>
				<pubDate>Thu, 24 Nov 2011 12:24:02 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[football scores python]]></category>
		<category><![CDATA[learn python in 2 days]]></category>
		<category><![CDATA[learning python]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[python threading]]></category>
		<category><![CDATA[python youtube]]></category>
		<category><![CDATA[server version scraper]]></category>
		<category><![CDATA[top 100 charts]]></category>
		<category><![CDATA[youtube charts]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=72</guid>
				<description><![CDATA[I had set myself a goal to make around 20 blog posts per year, it&#8217;s now almost December and I still have not bothered. It is safe to say I am not exactly prolific. I decided that I would learn python, surprisingly it&#8217;s been really easy to pick up and]]></description>
								<content:encoded><![CDATA[<p>I had set myself a goal to make around 20 blog posts per year, it&#8217;s now almost December and I still have not bothered. It is safe to say I am not exactly prolific.</p>
<p>I decided that I would learn python, surprisingly it&#8217;s been really easy to pick up and I thought I would share some of the things I made in my first 2 days of python.</p>
<p>The first I written was to phrase the results from yahoo&#8217;s football score page(http://uk.eurosport.yahoo.com/football/premier-league/2011-2012/results/2011_08.html). I was on this page anyway and thought why not!</p>
<blockquote><p>#!/usr/bin/python<br />
import urllib2<br />
import re<br />
response = urllib2.urlopen(&#8216;http://uk.eurosport.yahoo.com/football/premier-league/2011-2012/results/2011_08.html&#8217;)<br />
html = response.read()<br />
re_channel = re.compile(&#8220;&lt;td class=\&#8221;ko\&#8221;&gt;&lt;abbr class=\&#8221;dtstart\&#8221; title=\&#8221;\&#8221;&gt;([0-9a-zA-z ,:]*)&lt;/abbr&gt;&lt;/td&gt;&#8221; +<br />
 &#8220;\n &lt;td class=\&#8221;match.*?\n&#8221; +<br />
 &#8221; &lt;a href=.*?\&#8221;&gt;&#8221; +<br />
  &#8220;\n &lt;span class=\&#8221;home\&#8221;&gt;([a-zA-Z ]*)&lt;/span&gt;.*?&#8221; +<br />
  &#8220;\n &lt;span class=\&#8221;score\&#8221;&gt;([0-9 :-]*)&lt;/span&gt;.*?&#8221; +<br />
  &#8220;\n &lt;span class=\&#8221;away\&#8221;&gt;([a-zA-Z ]*)&lt;/span&gt;&#8221;, re.I | re.S | re.M)<br />
find_result = re_channel.findall(html)<br />
print find_result</p></blockquote>
<blockquote></blockquote>
<p>Sample output</p>
<p>[(&#8217;13 Aug, 15:00&#8242;, &#8216;Wigan Athletic&#8217;, &#8216;1 &#8211; 1&#8217;, &#8216;Norwich City&#8217;), (&#8217;13 Aug, 15:00&#8242;, &#8216;Fulham&#8217;, &#8216;0 &#8211; 0&#8217;, &#8216;Aston Villa&#8217;), (&#8217;13 Aug, 15:00&#8242;, &#8216;Blackburn Rovers&#8217;, &#8216;1 &#8211; 2&#8217;, &#8216;Wolverhampton Wanderers&#8217;), (&#8217;13 Aug, 15:00&#8242;, &#8216;Liverpool&#8217;, &#8216;1 &#8211; 1&#8217;, &#8216;Sunderland&#8217;), (&#8217;13 Aug, 15:00&#8242;, &#8216;Queens Park Rangers&#8217;, &#8216;0 &#8211; 4&#8217;, &#8216;Bolton Wanderers&#8217;), (&#8217;13 Aug, 17:30&#8242;, &#8216;Newcastle United&#8217;, &#8216;0 &#8211; 0&#8217;, &#8216;Arsenal&#8217;), (&#8217;14 Aug, 13:30&#8242;, &#8216;Stoke City&#8217;, &#8216;0 &#8211; 0&#8217;, &#8216;Chelsea&#8217;), (&#8217;14 Aug, 16:00&#8242;, &#8216;West Bromwich Albion&#8217;, &#8216;1 &#8211; 2&#8217;, &#8216;Manchester United&#8217;), (&#8217;15 Aug, 20:00&#8242;, &#8216;Manchester City&#8217;, &#8216;4 &#8211; 0&#8217;, &#8216;Swansea City&#8217;), (&#8217;20 Aug, 12:00&#8242;, &#8216;Sunderland&#8217;, &#8216;0 &#8211; 1&#8217;, &#8216;Newcastle United&#8217;), (&#8217;20 Aug, 12:45&#8242;, &#8216;Arsenal&#8217;, &#8216;0 &#8211; 2&#8217;, &#8216;Liverpool&#8217;), (&#8217;20 Aug, 15:00&#8242;, &#8216;Swansea City&#8217;, &#8216;0 &#8211; 0&#8217;, &#8216;Wigan Athletic&#8217;), (&#8217;20 Aug, 15:00&#8242;, &#8216;Aston Villa&#8217;, &#8216;3 &#8211; 1&#8217;, &#8216;Blackburn Rovers&#8217;), (&#8217;20 Aug, 15:00&#8242;, &#8216;Everton&#8217;, &#8216;0 &#8211; 1&#8217;, &#8216;Queens Park Rangers&#8217;), (&#8217;20 Aug, 17:30&#8242;, &#8216;Chelsea&#8217;, &#8216;2 &#8211; 1&#8217;, &#8216;West Bromwich Albion&#8217;), (&#8217;21 Aug, 13:30&#8242;, &#8216;Norwich City&#8217;, &#8216;1 &#8211; 1&#8217;, &#8216;Stoke City&#8217;), (&#8217;21 Aug, 14:05&#8242;, &#8216;Wolverhampton Wanderers&#8217;, &#8216;2 &#8211; 0&#8217;, &#8216;Fulham&#8217;), (&#8217;21 Aug, 16:00&#8242;, &#8216;Bolton Wanderers&#8217;, &#8216;2 &#8211; 3&#8217;, &#8216;Manchester City&#8217;), (&#8217;22 Aug, 20:00&#8242;, &#8216;Manchester United&#8217;, &#8216;3 &#8211; 0&#8217;, &#8216;Tottenham Hotspur&#8217;), (&#8217;27 Aug, 12:05&#8242;, &#8216;Aston Villa&#8217;, &#8216;0 &#8211; 0&#8217;, &#8216;Wolverhampton Wanderers&#8217;), (&#8217;27 Aug, 12:30&#8242;, &#8216;Wigan Athletic&#8217;, &#8216;2 &#8211; 0&#8217;, &#8216;Queens Park Rangers&#8217;), (&#8217;27 Aug, 15:00&#8242;, &#8216;Swansea City&#8217;, &#8216;0 &#8211; 0&#8217;, &#8216;Sunderland&#8217;), (&#8217;27 Aug, 15:00&#8242;, &#8216;Chelsea&#8217;, &#8216;3 &#8211; 1&#8217;, &#8216;Norwich City&#8217;), (&#8217;27 Aug, 15:00&#8242;, &#8216;Blackburn Rovers&#8217;, &#8216;0 &#8211; 1&#8217;, &#8216;Everton&#8217;), (&#8217;27 Aug, 17:30&#8242;, &#8216;Liverpool&#8217;, &#8216;3 &#8211; 1&#8217;, &#8216;Bolton Wanderers&#8217;), (&#8217;28 Aug, 13:00&#8242;, &#8216;Newcastle United&#8217;, &#8216;2 &#8211; 1&#8217;, &#8216;Fulham&#8217;), (&#8217;28 Aug, 13:30&#8242;, &#8216;Tottenham Hotspur&#8217;, &#8216;1 &#8211; 5&#8217;, &#8216;Manchester City&#8217;), (&#8217;28 Aug, 15:00&#8242;, &#8216;West Bromwich Albion&#8217;, &#8216;0 &#8211; 1&#8217;, &#8216;Stoke City&#8217;), (&#8217;28 Aug, 16:00&#8242;, &#8216;Manchester United&#8217;, &#8216;8 &#8211; 2&#8217;, &#8216;Arsenal&#8217;)]</p>
<p>The next was to obtain a list of the uk charts top 100 and find the youtube video for it.</p>
<blockquote><p>#!/usr/bin/python<br />
import urllib<br />
import urllib2<br />
import re<br />
import sys<br />
from BeautifulSoup import BeautifulStoneSoup  </p>
<p>def getvideolink(link):<br />
  request = urllib2.Request(link)<br />
  request.add_header(&#8216;User-Agent&#8217;, &#8220;Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Qt/4.7.0 Safari/533.3&#8221;)<br />
  response = urllib2.urlopen(request)<br />
  text = response.read()<br />
  videos = re.findall(&#8220;&lt;a href=\&#8221;/watch\?v=([\w-]+)&#8221;, text)<br />
  return &#8220;http://www.youtube.com/watch?v=%s&#8221; % videos[0]</p>
<p>response = urllib2.urlopen(&#8216;http://localhost/test&#8217;)<br />
html = response.read()<br />
re_channel = re.compile(&#8220;&lt;h3&gt;(.*?)&lt;/h3&gt;&#8221; +<br />
 &#8220;\r\n.*?&lt;h4&gt;(.*?)&lt;/h4&gt;.*?&lt;h5&#8243;, re.I | re.S | re.M)<br />
find_result = re_channel.findall(html)<br />
#remove first entry as it&#8217;s a dup<br />
del find_result[0]<br />
for result in find_result:<br />
 title=unicode(BeautifulStoneSoup(result[0],convertEntities=BeautifulStoneSoup.HTML_ENTITIES ))<br />
 artist=unicode(BeautifulStoneSoup(result[1],convertEntities=BeautifulStoneSoup.HTML_ENTITIES ))<br />
 link=&#8221;http://www.youtube.com/results?search_query=&#8221; + urllib.quote_plus(title);<br />
 print getvideolink(link)</p></blockquote>
<blockquote></blockquote>
<blockquote><p>Sample output</p></blockquote>
<blockquote><p>RIHANNA FT CALVIN HARRIS &#8211; WE FOUND LOVE // http://www.youtube.com/watch?v=tg00YEETFzg<br />
FLO RIDA &#8211; GOOD FEELING // http://www.youtube.com/watch?v=3OnnDqH6Wj8<br />
ONE DIRECTION &#8211; GOTTA BE YOU // http://www.youtube.com/watch?v=nvfejaHz-o0<br />
LABRINTH FT TINIE TEMPAH &#8211; EARTHQUAKE // http://www.youtube.com/watch?v=u0fk6syQ7iY<br />
ED SHEERAN &#8211; LEGO HOUSE // http://www.youtube.com/watch?v=c4BLVznuWnU<br />
DAVID GUETTA FT USHER &#8211; WITHOUT YOU // http://www.youtube.com/watch?v=jUe8uoKdHao<br />
MAROON 5 FT CHRISTINA AGUILERA &#8211; MOVES LIKE JAGGER // http://www.youtube.com/watch?v=iEPTlhBmwRg<br />
JLS &#8211; TAKE A CHANCE ON ME // http://www.youtube.com/watch?v=djV11Xbc914<br />
PROFESSOR GREEN FT EMELI SANDE &#8211; READ ALL ABOUT IT // http://www.youtube.com/watch?v=-_oLfC5Z_Ys<br />
CHRISTINA PERRI &#8211; JAR OF HEARTS // http://www.youtube.com/watch?v=8v_4O44sfjM<br />
LMFAO &#8211; SEXY AND I KNOW IT // http://www.youtube.com/watch?v=wyx6JDQCslE<br />
DRAKE FT RIHANNA &#8211; TAKE CARE // http://www.youtube.com/watch?v=PaXslpx3MWY<br />
COLDPLAY &#8211; PARADISE // http://www.youtube.com/watch?v=1G4isv_Fylg<br />
CHARLENE SORAIA &#8211; WHEREVER YOU WILL GO // http://www.youtube.com/watch?v=iAP9AF6DCu4<br />
SATURDAYS &#8211; MY HEART TAKES OVER // http://www.youtube.com/watch?v=DgmoYgpMNX8<br />
CHER LLOYD FT MIKE POSNER &#8211; WITH UR LOVE // http://www.youtube.com/watch?v=axpO86pGHAM<br />
BRUNO MARS &#8211; IT WILL RAIN // http://www.youtube.com/watch?v=W-w3WfgpcGg<br />
LADY GAGA &#8211; MARRY THE NIGHT // http://www.youtube.com/watch?v=O4IgYxHEAuk<br />
LANA DEL REY &#8211; VIDEO GAMES // http://www.youtube.com/watch?v=HO1OV5B_JDw<br />
PIXIE LOTT FT PUSHA T &#8211; WHAT DO YOU TAKE ME FOR // http://www.youtube.com/watch?v=OQCcwNMp830<br />
KELLY CLARKSON &#8211; MR KNOW IT ALL // http://www.youtube.com/watch?v=0C_oNMH0GTk<br />
LOICK ESSIEN &#8211; ME WITHOUT YOU // http://www.youtube.com/watch?v=lKDmJwoZ4RA<br />
FLORENCE &amp; THE MACHINE &#8211; SHAKE IT OUT // http://www.youtube.com/watch?v=WbN0nX61rIs<br />
COLLECTIVE &#8211; TEARDROP // http://www.youtube.com/watch?v=u7K72X4eo_s<br />
ONE DIRECTION &#8211; WHAT MAKES YOU BEAUTIFUL // http://www.youtube.com/watch?v=QJO3ROT-A4E<br />
ED SHEERAN &#8211; THE A TEAM // http://www.youtube.com/watch?v=UAWcs5H-qgQ<br />
WANTED &#8211; LIGHTNING // http://www.youtube.com/watch?v=MQyHyfLp5NI<br />
JESSIE J &#8211; WHO YOU ARE // http://www.youtube.com/watch?v=j2WWrupMBAE<br />
LUCENZO &amp; QWOTE &#8211; DANZA KUDURO // http://www.youtube.com/watch?v=rUFgacK8sZ0<br />
GYM CLASS HEROES/ADAM LEVINE &#8211; STEREO HEARTS // http://www.youtube.com/watch?v=T3E9Wjbq44E<br />
MAVERICK SABRE &#8211; I NEED // http://www.youtube.com/watch?v=VA770wpLX-Q<br />
WESTLIFE &#8211; LIGHTHOUSE // http://www.youtube.com/watch?v=Tivph7mTku4<br />
SEAN PAUL FT ALEXIS JORDAN &#8211; GOT 2 LUV U // http://www.youtube.com/watch?v=tDq3fNew1rU<br />
LADY GAGA &#8211; THE EDGE OF GLORY // http://www.youtube.com/watch?v=QeWBS0JBNzQ<br />
GLEE CAST &#8211; RUMOUR HAS IT/SOMEONE LIKE YOU // http://www.youtube.com/watch?v=qb7zjKkLCoQ<br />
SLOW MOVING MILLIE &#8211; PLEASE PLEASE PLEASE LET ME GET WHAT I // http://www.youtube.com/watch?v=DMQbzLrvwlE<br />
KATY PERRY &#8211; THE ONE THAT GOT AWAY // http://www.youtube.com/watch?v=Ahha3Cqe_fk<br />
ELBOW &#8211; ONE DAY LIKE THIS // http://www.youtube.com/watch?v=0NFV8dHrZYM<br />
CHRISTINA PERRI &#8211; A THOUSAND YEARS // http://www.youtube.com/watch?v=z5Q8x1wYN4w<br />
SNOW PATROL &#8211; THIS ISN&#8217;T EVERYTHING YOU ARE // http://www.youtube.com/watch?v=Q-Gljs8Y3Q8<br />
RIZZLE KICKS &#8211; WHEN I WAS A YOUNGSTER // http://www.youtube.com/watch?v=Rc2iUwMpb8Y<br />
GOO GOO DOLLS &#8211; IRIS // http://www.youtube.com/watch?v=NdYWuo9OFAw<br />
DAPPY &#8211; NO REGRETS // http://www.youtube.com/watch?v=WoImizvsj5w<br />
BRUNO MARS &#8211; MARRY YOU // http://www.youtube.com/watch?v=xB40cQD677s<br />
ADELE &#8211; SET FIRE TO THE RAIN // http://www.youtube.com/watch?v=ss0HAdW1DnY<br />
NICKELBACK &#8211; WHEN WE STAND TOGETHER // http://www.youtube.com/watch?v=76RbWuFll0Y<br />
AFROJACK &amp; STEVE AOKI &#8211; NO BEEF // http://www.youtube.com/watch?v=ksocjhxX_DQ<br />
ADELE &#8211; SOMEONE LIKE YOU // http://www.youtube.com/watch?v=hLQl3WQQoQ0<br />
PIXIE LOTT &#8211; ALL ABOUT TONIGHT // http://www.youtube.com/watch?v=swcULf1ATyU<br />
NICKI MINAJ &#8211; SUPER BASS // http://www.youtube.com/watch?v=4JipHEz53sU<br />
CALLING &#8211; WHEREVER YOU WILL GO // http://www.youtube.com/watch?v=iAP9AF6DCu4<br />
JAMES MORRISON &#8211; I WON&#8217;T LET YOU GO // http://www.youtube.com/watch?v=sgRb_lfIZ6A<br />
OLLY MURS FT RIZZLE KICKS &#8211; HEART SKIPS A BEAT // http://www.youtube.com/watch?v=j5dFe-WKuPs<br />
EXAMPLE &#8211; MIDNIGHT RUN // http://www.youtube.com/watch?v=iwYGi7YG4Js<br />
TINCHY STRYDER/CALVIN HARRIS &#8211; OFF THE RECORD // http://www.youtube.com/watch?v=UknZiaIC9y8<br />
SAK NOEL &#8211; LOCA PEOPLE // http://www.youtube.com/watch?v=-d6b1yn-YhQ<br />
BRUNO MARS &#8211; RUNAWAY BABY // http://www.youtube.com/watch?v=UDG_CrqJV-0<br />
JASON DERULO &#8211; FIGHT FOR YOU // http://www.youtube.com/watch?v=2aSOQRih6WY<br />
CHER LLOYD &#8211; SWAGGER JAGGER // http://www.youtube.com/watch?v=sdbyG2MrBHk<br />
LADY GAGA &#8211; BORN THIS WAY // http://www.youtube.com/watch?v=wV1FrqwZyKw<br />
SNOW PATROL &#8211; CALLED OUT IN THE DARK // http://www.youtube.com/watch?v=GwTXwJg6_VE<br />
WANTED &#8211; WARZONE // http://www.youtube.com/watch?v=yMR382aefmQ<br />
JLS FT DEV &#8211; SHE MAKES ME WANNA // http://www.youtube.com/watch?v=FuwTgZOKcf8<br />
NICOLE SCHERZINGER &#8211; TRY WITH ME // http://www.youtube.com/watch?v=R7sYiTyBjTY<br />
COBRA STARSHIP FT SABI &#8211; YOU MAKE ME FEEL // http://www.youtube.com/watch?v=HpyZEzrDf4c<br />
JESSIE J &#8211; WHO&#8217;S LAUGHING NOW // http://www.youtube.com/watch?v=KsxSxF3JKeU<br />
NOEL GALLAGHER&#8217;S HIGH FLYING &#8211; AKA WHAT A LIFE // http://www.youtube.com/watch?v=lwHpLDgWonM<br />
FOSTER THE PEOPLE &#8211; PUMPED UP KICKS // http://www.youtube.com/watch?v=SDTZ7iX4vTQ<br />
WRETCH 32 FT JOSH KUMRA &#8211; DON&#8217;T GO // http://www.youtube.com/watch?v=bj1BMpUnzT8<br />
BIRDY &#8211; SKINNY LOVE // http://www.youtube.com/watch?v=aNzCDt2eidg<br />
WANTED &#8211; GLAD YOU CAME // http://www.youtube.com/watch?v=2ggzxInyzVE<br />
BIRDY &#8211; PEOPLE HELP THE PEOPLE // http://www.youtube.com/watch?v=OmLNs6zQIHo<br />
NICKI MINAJ FT RIHANNA &#8211; FLY // http://www.youtube.com/watch?v=3n71KUiWn1I<br />
SKREAM FT SAM FRANK &#8211; ANTICIPATE // http://www.youtube.com/watch?v=O3Z1X4MPsqk<br />
WILL YOUNG &#8211; JEALOUSY // http://www.youtube.com/watch?v=9MHtrM-jf9o<br />
ADELE &#8211; ROLLING IN THE DEEP // http://www.youtube.com/watch?v=rYEDA3JcQqw<br />
JESSIE J FT BOB &#8211; PRICE TAG // http://www.youtube.com/watch?v=qMxX-QOV9tI<br />
LMFAO/LAUREN BENNETT/GOONROCK &#8211; PARTY ROCK ANTHEM // http://www.youtube.com/watch?v=KQ6zr6kCPj8<br />
JASON DERULO &#8211; IT GIRL // http://www.youtube.com/watch?v=4oGUHRXT-wA<br />
BEYONCE &#8211; COUNTDOWN // http://www.youtube.com/watch?v=ACkBTqwxcUI<br />
RIZZLE KICKS &#8211; DOWN WITH THE TRUMPETS // http://www.youtube.com/watch?v=-aY92XgykhU<br />
COLDPLAY &#8211; EVERY TEARDROP IS A WATERFALL // http://www.youtube.com/watch?v=fyMhvkC3A84<br />
CALVIN HARRIS &#8211; FEEL SO CLOSE // http://www.youtube.com/watch?v=dGghkjpNCQ8<br />
ADELE &#8211; MAKE YOU FEEL MY LOVE // http://www.youtube.com/watch?v=LLoyNxjhTzc<br />
ONE DIRECTION &#8211; ANOTHER WORLD // http://www.youtube.com/watch?v=RyZfNBVX1q0<br />
COLDPLAY &#8211; VIVA LA VIDA // http://www.youtube.com/watch?v=dvgZkm1xWPE<br />
BEYONCE &#8211; LOVE ON TOP // http://www.youtube.com/watch?v=Ob7vObnFUJc<br />
EAGLE-EYE CHERRY &#8211; SAVE TONIGHT // http://www.youtube.com/watch?v=dTa2Bzlbjv0<br />
EN VOGUE &#8211; DONT LET GO (LOVE) // http://www.youtube.com/watch?v=QUdAT5Fwnvk<br />
KATY PERRY &#8211; FIREWORK // http://www.youtube.com/watch?v=QGJuMBdaqIw<br />
MODESTEP &#8211; TO THE STARS // http://www.youtube.com/watch?v=UTKSUlMbp9A<br />
DRAKE &#8211; HEADLINES // http://www.youtube.com/watch?v=cimoNqiulUE<br />
ED SHEERAN &#8211; YOU NEED ME I DON&#8217;T NEED YOU // http://www.youtube.com/watch?v=temYymFGSEc<br />
WOODKID &#8211; IRON // http://www.youtube.com/watch?v=vSkb0kDacjs<br />
DELILAH &#8211; GO // http://www.youtube.com/watch?v=cxNe9jWNuEU<br />
KATY PERRY FT KANYE WEST &#8211; ET // http://www.youtube.com/watch?v=t5Sd5c4o9UM<br />
JAMES VINCENT MCMORROW &#8211; HIGHER LOVE // http://www.youtube.com/watch?v=9Z-fE1l9SZ4<br />
BRUNO MARS &#8211; JUST THE WAY YOU ARE (AMAZING) // http://www.youtube.com/watch?v=LjhCEhWiKXk<br />
PITBULL/NE-YO/AFROJACK/NAYER &#8211; GIVE ME EVERYTHING // http://www.youtube.com/watch?v=EPo5wWmKEaI</p></blockquote>
<blockquote></blockquote>
<blockquote><p>Then I wanted to test threading so I came up with something to check a list of links and obtain the &#8220;Server:&#8221; header</p></blockquote>
<blockquote><p>#!/usr/bin/env python<br />
import urllib2<br />
import re<br />
import os<br />
import sys<br />
import time<br />
from multiprocessing import Pool</p>
<p>#Accept file name as input or use default<br />
try:<br />
  filename = sys.argv[1]<br />
except IndexError:<br />
  filename = &#8220;links&#8221;</p>
<p>#Function to load urls from file<br />
def loadurls(filename):<br />
  try:<br />
    inputdata = file(filename).readlines()<br />
    if len(inputdata) &gt; 0:<br />
      return inputdata<br />
  except:<br />
    print &#8220;ERROR &#8211; Unable to process url list&#8221;<br />
    sys.exit()</p>
<p>#Function to get SERVER header<br />
def getversion(url):<br />
  try:<br />
      request=urllib2.Request(url)<br />
      response=urllib2.urlopen(request)<br />
      version=response.info().getheader(&#8216;Server&#8217;)<br />
  except:<br />
      return &#8220;ERROR &#8211; Unable to fetch %s&#8221; % (url)</p>
<p>  if version: print &#8220;Url: %s Version: %s&#8221; % (url, version)</p>
<p>start = time.time()<br />
urls=loadurls(filename)<br />
p = Pool(15)<br />
data = p.map(getversion,urls)</p>
<p>elapsed = (time.time() &#8211; start)<br />
print &#8220;Processed %s urls in %0.2f seconds&#8221; % (len(urls), elapsed)</p></blockquote>
<blockquote><p>Sample output</p></blockquote>
<blockquote><p>scott@scott:~/python$ ./server-header.py list<br />
Url: http://www.bbc.co.uk<br />
 Version: Apache<br />
Url: http://www.google.co.uk<br />
 Version: gws<br />
Url: https://scott.cm<br />
 Version: Apache<br />
Processed 4 urls in 1.07 seconds</p></blockquote>
<blockquote></blockquote>
<blockquote><p>None of these really serve any purpose and were merely tests I thought I would share.   Overall things have been quite easy and feel reasonably confident after just 2 days.</p></blockquote>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/learning_python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>2010 Recap</title>
		<link>https://scott.cm/2010-recap/</link>
				<comments>https://scott.cm/2010-recap/#respond</comments>
				<pubDate>Thu, 30 Dec 2010 11:56:26 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=59</guid>
				<description><![CDATA[So another year has passed and I have made 0 entries to the blog. This shall be the 8th post in 6 years. I thought it would be only fitting that I atleast end the year with a blog post and a commitment to blog more in 2011. This blog]]></description>
								<content:encoded><![CDATA[<p>So another year has passed and I have made 0 entries to the blog.   This shall be the 8th post in 6 years.  I thought it would be only fitting that I atleast end the year with a blog post and a commitment to blog more in 2011.</p>
<p>This blog post will be about what I have learned in 2010 and some plans for 2011.</p>
<p>So what have I learned,  enjoyed and hated in 2010?</p>
<p>&#8211; I love puppet</p>
<p>&#8211; Adobe flash is the bane of my life.  Flash on 64bit linux is nothing short of a pain,  it causes the most problems,  the most crashes and should rot in hell.</p>
<p>&#8211; I am starting to like chrome but have not made the full switch from firefox yet. </p>
<p>&#8211; I am quite a lazy programmer,  more worrying I actually don&#8217;t care.</p>
<p>&#8211; I love MongoDB and expect big things from it.</p>
<p>&#8211; I am unsure weather to love or hate r1soft.  On one hand I like what it brings on the other hand it&#8217;s very buggy and I don&#8217;t think the release of 3.0 is going to address many of these.   This should be an entire blog post in itself later.</p>
<p>&#8211; Started using ksplice uptrack,  already have this running on a few hundred systems and no problems to date.  Only time will tell.</p>
<p>I am looking forward to 2011,  I am hoping to continue on with getting large portions of the &#8220;todo list&#8221; completed.  Some of the ones off the top of my head are,</p>
<p>&#8211; Make the switch from cacti to collectd+MongoDB.  Been working on this on and off for awhile.  Primary goals is to make it more flexible,  more automated and easier to maintain.   Since we maintain so many different environments it has to fit some very specific needs.  Hoping to replace the primary cacti install and also some of the other secondary customer-specific ones (such as munin).</p>
<p>&#8211; Upgrade to nagios 3.x.  We still are running nagios 2.x so an upgrade is needed.  At the same time need to rebuild and rewrite the automation systems,  templates,  hosts and groups.    Especially to tie better into collectd,  the existing nagios+cacti setup is pretty &#8220;hacky&#8221;.</p>
<p>&#8211; Rebuild the client database,  notes and task list systems.    This work is already under-way so should be completed in Q1 2011.   Better encryption,  more functionality,  more flexibility,  easier to manage.</p>
<p>&#8211; Build a new ticket system and drop Kayako.   I don&#8217;t particularly like the direction Kayako has taken in their latest release so it&#8217;s time to stop using it (Very hacked up anyway).</p>
<p>&#8211; Better documentation.   I, along with many others, really fail in this area and I would love to improve on it.   Still toying with the idea of internal wiki&#8217;s combined with the existing notes systems and to make better use of them.</p>
<p>&#8211; Improve the existing yum repo,  make more use of mocks,  include some newer RPM&#8217;s and update all systems to use this.   Replace all custom builds to an RPM from the repo (nginx, memcached, etc).</p>
<p>&#8211; Make more use of the nessus systems and plugin feeds.   At the moment this is mostly semi-manual ,  need to work on making it fully automated and easy to maintain.</p>
<p>&#8211; Post more blog entries?   Goal of atleast 20 more blog posts (Less than 2 per month).  </p>
<p>&#8211; Rewrite the nagios r1soft/buagent check and release it.</p>
<p>&#8211; Make the vbulletin static cache into a plugin.   This is just a simple patch we provide to customers who don&#8217;t have enough capacity and are receiving a sudden burst of traffic (IE a thread slashdotted/etc). It simply stores the threads for guests in memory for 2 minutes and then displays the cache for guests (supports online counters, multiple themes,  browsers, mobile, etc).</p>
<p>That&#8217;s my list for the time being.   Lets hope I can stick to it.   Do you have your list ready?  Feel free to share.</p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/2010-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Bell&#8217;s palsy</title>
		<link>https://scott.cm/bells-palsy/</link>
				<comments>https://scott.cm/bells-palsy/#respond</comments>
				<pubDate>Sun, 01 Nov 2009 04:25:03 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[bells palsy]]></category>
		<category><![CDATA[facial nerves]]></category>
		<category><![CDATA[NHS]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=37</guid>
				<description><![CDATA[Since this is my blog I may as well write something about me. On Friday the 23rd I found out I had Bell&#8217;s palsy. From about Monday night I had been having a very annoying headache for certain periods at a small spot at the back right side of my]]></description>
								<content:encoded><![CDATA[<p>Since this is <em>my</em> blog I may as well write something about me.   On Friday the 23rd I found out I had <a href="http://en.wikipedia.org/wiki/Bell%27s_palsy">Bell&#8217;s palsy</a>.  From about Monday night I had been having a very annoying headache for certain periods at a small spot at the back right side of my head (Just behind the ear) which I thought I just banged my head but on Thursday night I noticed some strange reactions on my face but wasn&#8217;t sure what these were.    I continued on as normal assuming it would just go away in a few days and was just a headache,  it didn&#8217;t seem that important, neither was it painful &#8211; it was just annoying.</p>
<p>On Friday I definitely noticed something was not quite right but I was not sure,  as the day progressed I felt that the left side of my face was being odd and my eyes were hurting.   In a conference call I really noticed it as I started to speak and mentioned in IRC that I was having difficulty speaking clearly.</p>
<p>[17:25] &lt;Scott-Mc&gt; something is definitely wrong ,  even struggling to talk with the mic on the left side of my face:|<br />
&#8212;&#8211; then 10 minutes later &#8212;&#8211;<br />
[17:36] &lt;Scott-Mc&gt; god knows what is wrong with me, but I am even struggling to speak</p>
<p>After the conference was finished at about 6PM I started to think about all the things over the past few days and realized something wasn&#8217;t quite right and maybe it just wasn&#8217;t a bump to the head.  So I decided to call the NHS direct 24/7 helpline and after describing my symptoms and answering some questions I got put through to a nurse.   She started asking more specific questions because previously I had been unsure exactly what was wrong or how to describe it but within about 5 minutes she had determined what was wrong,  told me what it was and had arranged for me to visit the doctor at the A&amp;E.  </p>
<p>During the call she asked me to go stand in front of the mirror and smile,  it was then I realized that it wasn&#8217;t the left side of my face at all &#8211; this was perfectly normal,  it was the right side.  It was paralyzed and it was at this moment I freaked out,  especially because she said I should go to the A&#038;E just now. </p>
<p>It was very helpful just to speak to someone as otherwise I would have waited till Monday to go to the doctor if it had not cleared up but speaking to someone made me go immediately.  The symptoms did rapidly get worse between about 2PM-6PM as I never noticed it when I looked in the mirror earlier.</p>
<p>I arrived at the A&amp;E about 20 minutes later and waited 3-4 minutes to see a doctor.    Again I described my symptoms and he told me I had Bell&#8217;s Palsy and explained it alittle.   He prescribed me steroids for 1 week and some eye drops.  When I asked if he knew how long it would take he said and I quote,  &#8220;I wont lie, it can take awhile&#8221;.   I was unsure what to make of this but when I returned home it was straight onto google to read more on it.</p>
<p>As it turns out the vast majority recover from it (85%) and they don&#8217;t know what causes it.  So far it&#8217;s been 8-9 days and I would say that on the fourth day it showed signs of improvement that I definitely noticed (I could smile slightly more) but since then I don&#8217;t think it&#8217;s improved any which is alittle disappointing.  I would really like it to go away ASAP!</p>
<p>At this point I have another appointment with the Doctor on Monday to check the progress,  I am hoping it&#8217;s cleared up fully in about 2-3 weeks.  I hope this is realistic but to be honest it doesn&#8217;t really effect me all that much.  As I work from home I don&#8217;t notice it,  the only thing I notice is my right eye can be alittle painful as I have to manually blink it but this has been improving in the past few days also.  Overall I have a feeling I should treat this a serious thing but I have not been,  still can&#8217;t believe it&#8217;s been over a week with it already (I was going to blog about it the day after).</p>
<p>What is surprising is the number of number of friends and friends of friends have had this,  especially as I had never even heard of it before last week,  the good news is that all of them it cleared up just fine,  the bads news is that one of them took 6 months.</p>
]]></content:encoded>
							<wfw:commentRss>https://scott.cm/bells-palsy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Blogging</title>
		<link>https://scott.cm/blogging/</link>
				<pubDate>Sun, 11 Oct 2009 17:13:30 +0000</pubDate>
		<dc:creator><![CDATA[Scott Mcintyre]]></dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[scott mcintyre]]></category>
		<category><![CDATA[scottmcintyre]]></category>
		<category><![CDATA[server management]]></category>
		<category><![CDATA[sysadmin blog]]></category>
		<category><![CDATA[system administrator]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">https://scott.cm/?p=13</guid>
				<description><![CDATA[So it has been over 3 years since I created this blog and I have exactly 3 entries to date.   Blogging is something I have always been meaning to do but never actually got round to it.   I wouldn't consider myself a true blogger but I am devoted to giving it a go anyway.

Not knowing what to write about is generally what made me always not bother and then when there is a subject I am actually not that good at being creative.  The truth is though it is actually just lazyness that has stopped be.

So from today onwards I have decided to have an average of 2 blog posts per month and these can be about anything be it useful information,  a rant about a product/service or just a general meaningless post.]]></description>
								<content:encoded><![CDATA[<p>So it has been over 3 years since I created this blog and I have exactly 3 entries to date.   Blogging is something I have always been meaning to do but never actually got round to it.   I wouldn&#8217;t consider myself a true blogger but I am devoted to giving it a go anyway.</p>
<p>Not knowing what to write about is generally what made me always not bother and then when there is a subject I am actually not that good at being creative.  The truth is though it is actually just lazyness that has stopped be.</p>
<p>So from today onwards I have decided to have an average of 2 blog posts per month and these can be about anything be it useful information,  a rant about a product/service or just a general meaningless post.</p>
]]></content:encoded>
										</item>
	</channel>
</rss>
