Showing posts with label Adafruit. Show all posts
Showing posts with label Adafruit. Show all posts

Tuesday, April 14, 2015

Kodi Media Center

Just a quick run down on a little throw together media center/server I was able to throw together.
The monitor is one I had already, 24" samsung, with an audio 3.5mm out, hdmi, vga, and dvi inputs. It's been a good monitor, had it hooked to a mini pc, that I have lent to a housemate who's computer died. I keep warning them about unground outlets, and feedback into the electronics.  The speaker is an ihome, I picked it up at goodwill, had no ac adaptor, but I had one laying around from an old speaker system that was a nice match by specs and tip. Think this might be a fun set up to play with an old projector, and making my own screens. When I have a little spare currency I'll have to look at the goodwill site, and locally to see what I can come up with.
 I'm not much of an apple fan, it's not that they do not make quality products, it's that they are really not made for someone like myself. The I life is a bit more conducive to the tech being background, not a part of the fun.
 The tower is a slimline emachine, amd 64 bit, with only 2 gigs of ram, might upgrade the ram to 4, but really I'm not asking much of this machine, and I like that it's relatively low power consumption, and lower rpm fan system do not give off near the emf of high end system/ It was strangely enough as if brand new coming out the box, who ever had it before must have wiped before leaving it behind.  I still did a fresh install of win 7. The language pack updates are still by far the most time consuming of the process. Setting up Kodi is pretty simple, there are many tutorials online for specific options or settings.
This is all set up with dnla sharing, so it will stream all over the houses network.  As for control, below is my tablet, with the Yatse app that can link to any machine running Kodi providing it's been configured to allow for it.
All told this was a 7 doll hair set up for me, and I had been debating on turning my Raspberry Pi b+ into one. This is better solution all around, and allows me to push the Pi as either a twitter nanny bot, or look into setting it up a pirate box.

Jack
aka
PanseyBard

Thursday, February 19, 2015

Python, Tweepy, and Twitter.....Oh My!!!!

      If you landed here from twitter chances are you clicked a link provided by a bot.  This is not uncommon, everyday the access to easy to use development tools becomes more widespread.  Having not written a line of code since the late 80's imagine my surprise at how quickly a site like  codecademy walk me through entry level python.  Six days after the whim to check out python found me looking for a entry level project to solidify my newly acquired knowledge, and expose how sorely it was lacking.  So why a twitter bot?  I do not take things overly seriously.  That being said, I respect that other people do.  In twitter there is from my perspective a unique venue of real world interaction on a scale normally reserved for a few, along with low impact.  Meaning I am unlikely to cause anyone harm while messing around and learning, So while this is not intended in anyway to be a tutorial. After 6 days of an online course, and 3 days of playing, I hardly qualify.  The bot code currently looks like this:

#imports modulesimport tweepy, time, sys, random

#assigns text file arguments to variablesargfile = str(sys.argv[1])

#enter the corresponding information from your Twitter application:
CONSUMER_KEY = '123456'#keep the quotes, replace this with your consumer keyCONSUMER_SECRET = '123456'#keep the quotes, replace this with your consumer secret keyACCESS_KEY = '123456'#keep the quotes, replace this with your access tokenACCESS_SECRET = '123456'#keep the quotes, replace this with your access token secretauth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)

#sets up tweepy apiapi = tweepy.API(auth)


def hourlytweet():
    filename=open(argfile,'r')
    f=filename.readlines()
    filename.close()
    api.update_status(status=f)
    print("hourly tweet posted")


def follow_unfollow():
    followers = api.followers_ids()
    friends = api.friends_ids()

    for z in followers:
        if z not in friends:
            api.create_friendship(z)

    for z in friends:
        if z not in followers:
            api.destroy_friendship(z)
    print("follow, unfollow done")

def search_retweet():
        search_terms= ['python','technology','raspberry pi','anonymous','twitter bots']
        g = random.choice(search_terms)
        results = api.search(q=g, count=1)
        for u in results:
            api.retweet(u.id)
            print("retweeted top result for", g)



x=1y=2
while x<y:
    localtime = time.asctime(time.localtime(time.time()))
    hour = int(localtime[11] + localtime[12])
    print('current hour is:',hour)
    if hour>5 and hour<24:
        hourlytweet()
        time.sleep(1700+random.randint(200,400))
        search_retweet()
    elif hour == 24:
        follow_unfollow()
    time.sleep(1700+random.randint(200,400))


It currently has the basic functions, between 6am, and midnight local time, it will tweet from a textfile, than wait roughly 30 min. Perform a search on a term selected randomly from a list, and retweet the top result. wait roughly 30min and start over. At midnight, it will check for new followers and follow them, then check for unfollowers, and unfollow them.  Next I'll be looking at adding some more functionality, perhaps checking for mentions, and favorites.  Maybe adding in an exit condition, other than a crash or keyboard break.

Thanks for reading
and always make up your own damn mind

Jack
aka
PanseyBard

Tuesday, February 17, 2015

Pseudo Productivity, or....Filling the Void.

The Setup:

     I grew up an only child, raised by a single mother who worked, and finished her education during most of my childhood.  This means I learned quite early how to be with myself as my only company. A nice match for my natural introvert tendencies. For reasons beyond the scoop of today's posting this proclivity for the avoidance of social interaction has gone from mildly reclusive, to almost full blown hermit over the course of the last year plus.  With freeing of time has come the desire to fill it with something other than movies, games, and maryjane.  So like many I have turned to learning, and as a tech lover, many of learning choices have been in that direction.


The Flourish:

      Once the wallowing in self pity ebbed to a point where the desire for activity could rise through the fog of self medication. What has become a concept of pseudo-productivity began.  An interesting concept in itself, basically meaning structured, goal oriented activity, where the activity is the reward. Video games are great examples of pseudo-productivity, having purpose only within the context of the game, and no real bearing outside itself.  The sense of accomplishment achieved can have profound effects on the psyche both positive, as well as negative.  Leading to a greater healing, or descending into a false sense stability.  So between scrambling to keep enough currency flowing to maintain my meager lifestyle, while avoiding as much face to face social interaction with public. I've had plenty of pseudo productivity, some days even measuring my day in these terms only.  


The Reveal:

     When the student is ready the teacher shall appear, seemingly extends far into abstraction.  Back in December a friend gifted me with a Raspberry Pi b+, and it quickly became a great outlet for my desire for productivity.  Though after running through Kodi(raspbmc),  Retropie, and the basics of Raspbian.  It became abundantly clear how end user oriented my interaction with technology had become.  While this serves me quite nicely in helping other end users, it does little to really give a sense of creative outlet.  It's more about being about to understand and follow directions, with being creative being a hinderance.  Than came some practical use ideas of said Pi, a vpn, personal cloud storage, a local file sharing node(priate box), to name a few.  Of course these all have the same fatal flaw, it's just following directions to setup.  In learning about the Pi, the linux environment, and development.  I became exposed to modern programming languages, having stayed away from the software side since the late 80's.  Exactly as the Pi's creators intended, my inner child responded. With the Pi as my platform, the language of choice was made easy, python. Off to Codecadey for an interactive course. Big ups to the folks over there, the interface is great, being able to code right in the browser, and receive instant feedback makes for an enjoyable experience.  Only issue with that was an odd interaction with the chrome instant translate extension wanting to translate my code as I wrote it.  Six days later, now I need to use it, or like so many things it will be quickly forgotten, but what to make.  If you came upon this blog from twitter, than you likely have already encountered my starter project.  A Pi based Twitter bot, big thanks to Dototot for the basic idea, and a framework to start from.  Thus far it's very limited, only tweeting once roughly an hour. A future post will go more in depth on the bot itself, but given it's rudimentary nature. That would be premature.


Share, Flame, Whatever
Just make up your own damn mind

Jack
aka
PanseyBard

Saturday, January 3, 2015

Adventures in Raspberry Pi, First Impressions

                                          My Piary

           Having had a week or so to play with the Raspberry Pi b+.  The possibilities of this device are amazing.  It brings visions of cartridge systems, only your swapping out complete Os's.  So far I've had a chance to play with 3 of the more widely used, RaspbianRetropie, and Kodi, more commonly known as Xbmc. Right off the bat a major difference is felt, yes this is a hobbyist flavor of Pc experience.  Having oft bemoaned not being in full control of "my" devices this was a welcome change, even if it meant some setup required.  For the techie types it's a blast, the versatile nature of the platform allow for usage from, basic computer to robots, or home automation.  For non techies while you may not want to be involved in the setup, you might be surprised by just what this little board could be setup to do for you.  

http://www.canakit.com/raspberry-pi-starter-ultimate-kit.html

        The basics

         Keep in mind the Pi, out of the box is a small main board, so it's all about what you add to it. The peripherals, and software make or break the experience here.  With that in mind, have a case, or some way to mount the board, it would be a shame to short something out before even getting started.  While buying a pre installed/configured  sd card does allow for plug and play type setup. Having a linux or windows based pc is a must if you intend to be more creative on build side.  While there are 4 full sized usb ports on the board, devices like external hd's will need external power source, so a powered usb hub can be almost a mandatory add on.  Have your input devices picked out in advance, if you plan on using your pi for retro gaming, or for streaming video, be sure the devices are supported, and you know where/how to install the drivers.  Command line is your friend.  We are all pretty spoiled by our intuitive gui's, and improvements in voice control.  Getting the most out of the Pi is likely to lead to spending some time in a text only environment. Get a class 10 sd card.  Having used 3 different cards thus far, a google search will yield some good information. A general rule of thumb go for the higher speed.  A wifi usb dongle, with wireless connectivity built into to almost everything these days, this might see obvious.  A really good source for information, ideas, and products is Adafruit Industries.  

        Raspbian

        The linux distro made for the Pi.  These boards we created with education in mind, so packaged in are all sorts of learning tools.  This was my first stop, and is the suggested OS to get a feel for what the Pi is about.  That being said, of the three, this is the one I have spent the least time in.  Going
forward that is sure to change, as it is likely to be the foundation for my next 3 pi projects. Those familiar with linux will be right at home, apple, and windows users will experience a bit of a learning curve.  While apple, and microsoft have been moving toward the OS taking charge of much of the day to day maintenance, linux only does what it's told.  With so many built in, and available development tools. This is a solid foundation to build on. For the application specific diy folks, the OS is built on a core, known to be solid, and designed to run with little to no supervision once set up.
Linux servers have been known to run for years without a reboot.  Certainly will have more to cover on this one in the coming weeks, as it will be the likely OS of my next few projects.


       Retropie

        Ever wanted your own arcade machine, or just hanker for some nostalgic video gaming fun.
 Retropie just might be the answer for you.  From ti99 through to mame, and up till n64 and ps1.  This is an emulation package OS using emulation station.  Configuration can be a bit tricky, and some of the emulators need a bit of tweaking.  When combined with the Pi i/o pinout you can fairly easily create professional level arcade style machines in your home.  For my purpose nothing so elaborate is needed, though I have to admit to a wish to make a dedicated arcade cabinet. Complete with arcade style controls.  Access to literally thousands of games, with the flick of a gamepad almost crosses into choice paralysis.  Setting this one up can be a bit tricky, like so much open source it's not a finished product, but forever a work in progress.  A few of the emulators will take some more time on my part to work out the settings needed.  Some are simple, and worked almost like plug and play. Making your own portable device is a realistic project, or perhaps it's a diy for the car dvd player. Of the three, this one held the most initial excitement for me.  Gaming being near, and dear.  There are just some games that never get remade, or get so changed in the updating, playing them old school is the only solution.  Of the emulators I tried, neogeo, and n64 were not plug and play style ready, and I have yet to spend any time in getting them functional.  N64 locked up the system each time I tried to load a rom, and neogeo didn't seem to function at all. A quick google search leads me to feel these can be fixed for the most part through some configuration.  Once those are functional, and some testing of the ps1 emulator, could see it replace the android mini pc as my goto for retro gaming.


       Kodi

         Kodi, or as formerly known Xbmc is an OS for a media center.  This one was of the three the one that attracted me the least originally.  Having for the last couple of years been using an android mini-pc for almost all my media needs.  I even installed an earlier version of Xbmc on my mini pc at one point.  It did not functional very well, more from the model of mini pc I have than anything else. This less than stellar earlier experience meant I had not really low expectations, just they were virtually non-existent.  Installing it started out just to see what it could do, just how many tricks could this pony learn kind of idea.  To say I have been blown away, is not praise enough, to admit that
losing the use of the Pi has stalled other exploration would be more accurate.   This is an OS designed to be controlled through a remote. Once setup is complete it can often be run right off your existing tv remote, through the hdmi cable.  Many of us are used to having apps on our TV's, netflix, and the like are common fodder for almost ever smart tv around.  Some will probably have like myself been using android mini pc's.  Kodi is like smart tv on steroids, with the ability to integrate your tv service, with data, and streaming services of the web, be prepared to get lost for a few days just playing with all the features.  This can be as custom or generic an experience as desired.  Want to set up a complete home theater experience with one click controls to home automation scripts? You can do that.  How about a central media server with plenty of storage for all your movies, pictures, and music, and access from screen in the house? You can do that!  Being an open source project, find something Kodi doesn't do, and you can learn, and code it, Or at least suggest it to one of the folks in the active community of developers.  When combined with the low power consumption, 24/7 run design of the Pi, Kodi is without a doubt a blast to design your media experience the way you want it.  Forget the ilife, Kodi allows you to really make it your own,


Next will be a vpn pi, just as soon as I can make myself go without kodi for a few days.

Jack
aka
PanseyBard