background preloader

Python for Bash scripters: A well-kept secret

Python for Bash scripters: A well-kept secret

s Python Class - Google's Python Class - Google Code Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. To get started, the Python sections are linked at the left -- Python Set Up to get Python installed on your machine, Python Introduction for an introduction to the language, and then Python Strings starts the coding material, leading to the first exercise. This material was created by Nick Parlante working in the engEDU group at Google. Tip: Check out the Python Google Code University Forum to ask and answer questions.

Scripting, Part Two: Looping for Fun and Profit Crafty System Administrators who want to conserve energy need to learn the fine art of looping. You energy-conserving* system administrators will enjoy learning to use loops in your scripts. Looping is a technique that allows you to repeat a process or set of commands indefintely or until the loop exhausts a particular list of items. For example, you want to copy a particular file to everyone’s home directory. How do you do it? Don’t worry if you aren’t a scripting master, I’m going to take it slow through this series so that you can absorb what’s going on. The Basics You need access to a Linux system and last week’s post, “Scripting, Part One”. The Lively Loop There’s nothing particularly special about a loop. My original example is a good one. First, look at what’s needed to make this happen: a list of users, the file in question, and, depending on the file’s purpose, an optional permissions change. Next, put your needs into Linux terms. #! khess nimbus bob matthew mark luke john #! #!

Git is easy to learn For a while now I've had to listen to people tell me that git is somehow more complicated than other distributed source code management tools. A very recent example was what Robert O'Callahansaid about a month ago talking about mercurial: Best of all the underlying model seems quite simple and I think I understand it having read a few chapters of hgbook. I used git with cairo without ever really understanding what git was doing. This really confused me because I think I understand both git and mercurial fairly well, and I just don't see big user-visible differences in the "model" that they offer---particularly for new users. So I went and took a look at the book he referred to, (Distributed revision control with Mercurial by Bryan O'Sullivan). So I thought it might be an interesting project to "port" this chapter from mercurial to git. Well, I put the project off for a month because I think the feelings and desires of authors are important, in spite of what the license makes possible.

opensource Click here to view the original content Comments: Please enable JavaScript to view the <a href=" Related Content: Open source news roundup: February 15-20, 2015 | Opensource.com In this week's edition of our open source news roundup, we take a look at OnePlus adopting a new mobile OS, robots powered by the Raspberry Pi 2,and more! Open gaming roundup: February 15 - 21, 2015 | Opensource.com In this week's edition, we take a look at a Kickstarter bringing physicality to video games, how the Kano is teaching young girls to make games, the new World Video Game Hall of Fame, and more! Becoming an open source developer | Opensource.com Contributing to open source can be incredibly rewarding. Making open source software accessible to all | Opensource.com As the user base of open source software continues to grow, developers have the responsibility of making their software accessible to all potential users, including people with disabilities.

Python Programming in your Browser: PythonAnywhere The os.path module This module contains functions that deal with long filenames (path names) in various ways. To use this module, import the os module, and access this module as os.path. Working with file names This module contains a number of functions that deal with long filenames in a platform independent way. In other words, without having to deal with forward and backward slashes, colons, and whatnot. Example: Using the os.path module to handle filename # File: os-path-example-1.py import os filename = "my/little/pony" print "using", os.name, "..." print "split", "=>", os.path.split(filename) print "splitext", "=>", os.path.splitext(filename) print "dirname", "=>", os.path.dirname(filename) print "basename", "=>", os.path.basename(filename) print "join", "=>", os.path.join(os.path.dirname(filename), os.path.basename(filename)) using nt ... split => ('my/little', 'pony') splitext => ('my/little/pony', '') dirname => my/little basename => pony join => my/little\pony /home/effbot/.pythonrc . . .

Stories from the land of Rob » Blog Archive » In Critique of Git Now as anyone who knows me knows, I love Git. I find it gives a very productive and comfortable workflow. One of my favourite new(ish) features is git rebase --interactive, which along with cheap’n'fast branching gives a great way to hack and commit as you go and then later on refactor your work into sets of nice orthogonal patches. However, there I do still find a good few things wrong with git, so I’d like to discuss these problems and possible solutions: Error MessagesIn general git has some terrible cryptic error messages. So, what do people think? After some discussion, I’ll happily take these to the git mailing list and come up with some patches!

Wind Empowerment Athens 2014 | Indiegogo Wind Empowerment Athens 2014 While everyone is talking about renewable energy, power generation from small wind turbines is not thriving. The issues that are usually raised have to do with quality, reliability, and the cost of installation. However, self-constructed wind turbine projects are one sector of wind energy that is thriving. Self-constructed wind turbines offer a real alternative, as they enable local people to build and maintain the technology, which makes all the difference. Today, 1.4 billion people worldwide have no access to electricity. Small wind turbines offer viable and sustainable means for remote communities to manage their own local resources and lift themselves out of poverty. Wind Empowerment is an association that is active in the development of small, self-constructed wind turbines, originally designed by Hugh Piggott, to enable rural electrification. Wind Empowerment is composed of 37 organizations in 28 different countries. The program for the week will include:

Learn Python - Free Interactive Python Tutorial

Related: