Title
All things Seth Mason
Go Home
Description
Programming, books, emacs and an old man yelling at a cloud.
Address
Phone Number
+1 609-831-2326 (US) | Message me
Site Icon
All things Seth Mason
Tags
Page Views
0
Share
Update Time
2022-05-05 16:38:58

"I love All things Seth Mason"

www.sethmason.com VS www.gqak.com

2022-05-05 16:38:58

All things Seth Mason Books I Read in 2020Fri 01 January 2021Adios 2020! You won't soon be forgotten, that's for sure. Aloha 2021! In the spirit of getting things off on the right foot, I'm posting the books I read right on time!Only 17 books this year. Gonna blame too much binge watching of TV shows and alot of time riding my bike. I seemto be rapidly falling away from my goal of reading 50 books a year.Particular highlights were The Water Dancer by Ta-Nehisi Coates,Nothing to See Here by Kevin Wilson and The Plot Against America byPhilip Roth. The Roth book was pretty frightening given currentcirumstances.But let's not end on a bad note. Here's to a new year!Aurora by Kim Stanley Robinson (4 stars)The Nickel Boys by Colson Whitehead (5 stars)The Space Between Worlds by Micaiah Johnson (4 stars)Of Love and Dust by Ernest J. Gaines (5 stars)Interior Chinatown by Charles Yu (5 stars)Wow, No Thank You.>> import pandas as pd>>> fec = pd.read_csv('P00000001-ALL.csv')Looking into the data, there is some garbage rows. I grabbed all the CulverCity zip codes (well, the zip codes I care about) at least:>>> zips = fec.contbr_zip.unique()>>> mask = np.array([str(x).startswith('90232') for x in zips])>>> fec[fec.contbr_zip.isin(zips[mask])].contbr_city.value_counts()CULVER CITY 241CUILVER CITY 2SANTA MONICA 1I don't know if these come from bad data from the contributor or from the FEC so I'm justgoing to include everything based on zip code.>>> culver = fec[fec.contbr_zip.isin(zips[mask])]>>> culver.contb_receipt_amt.sum()58341.0Fifty-eight grand! Nice going Culver City!Now let's see who got the money:>>> culver.pivot_table('contb_receipt_amt', rows='cand_nm', aggfunc=sum)cand_nmHuntsman, Jon 4500Obama, Barack 50381Paul, Ron 500Roemer, Charles E. 'Buddy' III 110Romney, Mitt 2850That's kind of interesting...Huntsman got more money from the 90232 thanRomney.Now, let's check out the occupations that contributed the most:>>> culver.pivot_table('contb_receipt_amt', rows='contbr_occupation',... aggfunc=sum).order(ascending=False).head(10)contbr_occupationRETIRED 7272.0ACCOUNT MANAGER 5000.0VICE PRESIDENT, INTERNET MARKETING 4000.0PROFESSOR 2800.5PRESIDENT & C.E.O. 2500.0GALLERY OWNER 2500.0BOOKKEEPER 2500.0HOMEMAKER 1971.0INTERIOR DESIGNER 1500.0WRITER 1410.0Retirees going large. That's kind of interesting. Let's look at that.>>> culver[culver.contbr_occupation == 'RETIRED'].pivot_table(... 'contb_receipt_amt', rows='cand_nm', aggfunc=sum)cand_nmObama, Barack 7162Roemer, Charles E. 'Buddy' III 10Romney, Mitt 100Maybe I misunderstand our local retirees (at least the ones I've met) but this wassurprising to me. I really expected Romney to come out on top.I think that's enough peeking into my neighbors contributions habits for onenight. I have to say Pandas makes this sort of thing really easy.I've only scratched the surface here. There's lots more that one can do(mathematically speaking) with Panads. Python for Data Analysis givesyou a really good introduction to Pandas and then the webiste fillsin the gaps.Python for Data Analysis and Panads get two thumbs up from me. Thanksto O'Reilly and Wes McKinney. Add a commentCategory:programmingTags: pythonpandas Python and Spotify Together At LastThu 26 January 2012Here's a simple script to show the currently playing song in Spotify. All youhave to do is put it on your $PATH and run:> nowplayingThe Unsinkable Fats Domino by Guided By VoicesWhile this is handy in and of itself (to some people), if you are runningGNU Screen, you can have it output thecurrently playing song in your statusline. Just add the following to your .screenrc:backtick 101 5 5 /home/YOURNAME/bin/nowplayinghardstatus string '%101`'If you already have a hardstatus (or caption) line, you'll just need toadd %101 in there somewhere. Then, you'll have the currently playing songeasily available.For info about what the above does, see the GNU Screen manual about backtick.Here's the entire script:#!/usr/bin/env python"""Spit out the currently playing song."""import dbusimport systry: bus = dbus.Bus(dbus.Bus.TYPE_SESSION) spotify = bus.get_object('com.spotify.qt','/') info = spotify.GetMetadata()except dbus.exceptions.DBusException: print('Spotify is not running') sys.exit(1)track = {}trackMap = { 'artist' : 'xesam:artist', 'album' : 'xesam:album', 'title' : 'xesam:title' }for key, value in trackMap.items(): if not value in info: continue piece = info[value] if isinstance(piece, list): piece = ', '.join(piece) track[key] = piece.encode('utf-8')if track.has_key('title') and track.has_key('artist'): print('%s by %s' % (track['title'], track['artist']))else: print('No song playing')If you want Spotify to use the built-in notifier in Ubuntu, then by all meanscheck out Spotify-notify. It alsoadds support for media keys. Add a commentCategory:musicTags: pythonspotify Books I Read in 2011Wed 21 December 2011So, it's been over a year since my last "Books I Read" post so it's timeI suppose. Only 28 books this year but this includes the behemoths that make up the firstfive books of the A Song Ice andFire series so my page count is probably a bit higher this year. Hrm, thatmight be the job for a different script.Looking over the list, books that stand out for me this year include TheWoman in White, Stateof Wonder and A Visit from the Goon Squad.If you want up to the minute updates, I suggest you follow me on Goodreads.A Dance With Dragons (A Song of Ice and Fire, #5) by George R.R. Martin A Feast for Crows (A Song of Ice and Fire, #4) by George R.R. Martin A Storm of Swords (A Song of Ice and Fire, #3) by George R.R. Martin A Clash of Kings (A Song of Ice and Fire, #2) by George R.R. Martin State of Wonder by Ann Patchett Under the Banner of Heaven: A Story of Violent Faith by Jon Krakauer World War Z: An Oral History of the Zombie War by Max Brooks Super Sad True Love Story by Gary Shteyngart The Immortal Life of Henrietta Lacks by Rebecca Skloot A Game of Thrones (A Song of Ice and Fire, #1) by George R.R. Martin The Kid by Sapphire A Visit from the Goon Squad by Jennifer EganMister Pip by Lloyd Jones Just Kids by Patti Smith The History of Love by Nicole Krauss A World on Fire: Britain's Crucial Role in the American Civil War by Amanda Foreman The Moonstone by Wilkie Collins The Woman in White by Wilkie Collins The Adventures of Sherlock Holmes by Arthur Conan Doyle Master of Shadows: The Secret Diplomatic Career of the Painter Peter Paul Rubens by Mark Lamster Robinson Crusoe by Daniel Defoe Test-Driven JavaScript Development by Christian Johansen Pomodoro Technique Illustrated: Can You Focus - Really Focus - for 25 Minutes? by Noteberg Staffan Bossypants by Tina Fey At the Mountains of Madness by H.P. Lovecraft Behind Closed Doors: Secrets of Great Management by Johanna Rothman City of Ruin (Legends of the Red Sun, #2) by Mark Charan Newton Pride and Prejudice by Jane Austen Full disclosure: Most of the book links on this page are Amazon affiliatelinks so I get some coin when you buy something. Add a commentCategory:readingTags: books The Big Easy 2011Thu 10 November 2011TL;DR: I use quite a bit of software.For no particular reason other than I need to post something to make up for all the times I didn't post (and because I love making lists), here's a list of the software that I use day to day.Ubuntu: My main machine is running Ubuntu 11.04. I've got other boxes running older versions of Ubuntu (as well as OS X) but this is where my hat hangs for the time being. Speaking of hanging, Unity almost made me want to hang myself but I think I have it dialed into where I like it. Hidden inside the Compiz settings are some sweet keyboard shortcuts for windows management, which is the only reason I tried out xmonad for as long as I did.GNU Emacs: Emacs is probably where I spend about 90% of my day. I've got it to the point where I hardly touch the configuration files anymore. People complain that emacs users spend tons of time fiddling with settings but you have to average that over the lifespan of you using the software. So the time setting it up isn't that much really. Emacs probably demands its own post about all the packages that I use come to think of it.Google Chrome: Yep, I ditched Firefox. Chrome just seems a lot faster and the developer tools are built in and rock solid. Seeing as how Firebug was staring to cause me to stab my eyes out, I'm quite happy now.Dropbox: This is a service that I actually pay for. At my last job, dropbox was blocked and it made my life kind hellish. Without it, all my ebooks, projects and personal wiki are inaccessible.KeePassX: The older the get, the more I forget. And when it comes to the bazillions of passwords I need to remember for various sites, I rely on KeePassX. Open source and available on multiple platforms, it's a keeper. Har har! Get it? Keeper. KeePassX. I should move over to marketing.Spotify: Another service that I pay for. The huge selection of songs and the integration with Facebook make it kind of hard to pass up. I mention Facebook because it's good fun to queue up weird songs so they end up on your wall and your Mom gets to see it.Git: Yeah, I spend way too much time in git but I use it and it suits my software development needs. So much so, that I use git to interact with our Subversion repository at work.Remeber the Milk: Another piece of software that I pay for. I know this is technically a web service but I have software installed for it on my phone and tablet so I'm lumping this into the software post.urxvt: I'm using this less and less now that I've been using Emacs to run my shell but when I need to run complex commands, this is the termianal I turn to. My shell of choice is Zsh.Oh My Zsh!: Speaking of Zsh, this is a great collection of very useful Zsh configurations and aliases which make working with Zsh very very nice.homedir: I don't know how I exactly found homedir but it's very sweet. It's basically a small package manager for your home directory. I use to keep all configurations the same across machines. And where I need a machine specific configuration, homedir comes to the rescue. I don't really use this day to day but thought it was worth mentioning because it's saved my bacon a few times.That about wraps up what I'm using day to day. I use other things on-and-off(like LibreOffice -- shudder) but didn't think they were worth putting in the post. Add a commentCategory:personalTags: software Moustaches For Good!Thu 03 November 2011Sooo...hey! How ya' doing? Long time no see. Hope you've been well. Aside frombeing broken up over the breakdown of Google Reader, I've also beenbusy growing a moustache for Movember.You can donate to my cause at http://mobro.co/sethmason. Feel free to passit around! Add a commentCategory:personalTags: donatemovember JSLint and git blame for fun and profitWed 04 May 2011For some unknown reason, we have a problem with superfluous trailing commas atwork in our JavaScript. It's probably because we have a bunch of Perldevelopers writing JavaScript. Unfortunately, this doesn't play well in aworld with Internet Explorer.JSLint makes this easy enough to track down. But Iwanted something more. I wanted to know who the culprits were. Thus, I whippedup this little script that'll take a list of files and tell you who committeda file with a trailing comma in it. Besides, JSLint, You'll needRhino and a script to execute commands(named runtime.js). I'll try and post that later.// blame_comma.js -- loop through the files passed in and see who has// commas in them// find ../htdocs/js/ECM -type f -name "*.js" -print | \// xargs java -classpath \// /usr/share/yuicompressor-2.4.2/lib/rhino-1.6R7.jar \// org.mozilla.javascript.tools.shell.Main blame_comma.jsload('fulljslint.js');load('runtime.js');(function(args) { var bad_files = {}; for (var i = 0; i