-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtipuesearch_content.json
1 lines (1 loc) · 6.94 KB
/
tipuesearch_content.json
1
{"pages":[{"text":"In this article I write about Joe – Python tool that makes creating .gitignore files much easier. Problem Every time I create new project, there comes time, when I want to put it under git control and do the first commit: $ git init Initialized empty Git repository in </path/to/directory> $ git status # good practice - check before commit # (...) Untracked files: ( use \"git add <file>...\" to include in what will be committed ) __init__.pyc __pycache__/ openstack.pyc test.py In this moment I realize that I have forgot to add .gitignore. And to be honest, hate to do this. What should I place there? Should I put this __pycache__ folder too? But have no fear Joe is here . Joe will generate .gitignore for you: $ joe python > .gitignore $ cat .gitignore ### joe made this: https://goel.io/joe #####=== Python ===##### # Byte-compiled / optimized / DLL files __pycache__ \\* .py [ cod ] # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg #( ... ) Joe can create gitignore rules for many other files: $ joe list actionscript, ada, agda, android, anjuta, appceleratortitanium, archives, archlinuxpackages, autotools, bricxcc, c, c++, cakephp, cfwheels, chefcookbook, clojure, cloud9, cmake, codeigniter, codekit, commonlisp, composer, concrete5, coq, craftcms, cvs, dart, darteditor, delphi, dm, dreamweaver, drupal, eagle, eclipse, eiffelstudio, elisp, elixir, emacs, ensime, episerver, erlang, espresso, expressionengine, extjs, fancy, finale, flexbuilder, forcedotcom, fortran, fuelphp, gcov, gitbook, go, gradle, grails, gwt, haskell, idris, igorpro, ipythonnotebook, java, jboss, jdeveloper, jekyll, jetbrains, joomla, jython, kate, kdevelop4, kohana, labview, laravel, lazarus, leiningen, lemonstand, libreoffice, lilypond, linux, lithium, lua, lyx, magento, matlab, maven, mercurial, mercury, metaprogrammingsystem, meteor, microsoftoffice, modelsim, momentics, monodevelop, nanoc, netbeans, nim, ninja, node, notepadpp, objective-c, ocaml, opa, opencart, oracleforms, osx, packer, perl, phalcon, playframework, plone, prestashop, processing, python, qooxdoo, qt, r, rails, redcar, redis, rhodesrhomobile, ros, ruby, rust, sass, sbt, scala, scons, scrivener, sdcc, seamgen, sketchup, slickedit, stella, sublimetext, sugarcrm, svn, swift, symfony, symphonycms, tags, tex, textmate, textpattern, tortoisegit, turbogears2, typo3, umbraco, unity, vagrant, vim, virtualenv, visualstudio, vvvv, waf, webmethods, windows, wordpress, xcode, xilinxise, xojo, yeoman, yii, zendframework, zephir So if you are convinced, you will find Joe here","tags":"Programming","loc":"http://kendriu.com/joe","title":"Joe"},{"text":"This is something, that I always have to check. So today I'm writing it down. Documentation to subprocess.Popen is here . So pipelines are useful when you want to do something with output of command performed by Popen. What you would like to do with output: pass it to another bash command use it inside Python script Pass output to another bash command So you want to pass output of first bash command to another. This will be equivalent of this code in bash: $ ls /etc | grep ntp ntp-restrict.conf ntp.conf ntp_opendirectory.conf In Python you do that like this: ls = subprocess . Popen ( 'ls /etc' . split (), stdout = subprocess . PIPE ) grep = subprocess . Popen ( 'grep ntp' . split (), stdin = ls . stdout , stdout = subprocess . PIPE ) output = grep . communicate ()[ 0 ] Do it in the proper way Call ls.stdout.close() before grep.communicate() so that if grep dies prematurely, ls would exit sooner. And add ls.wait() at the end, to avoid creating a zombie: ls = subprocess . Popen ( 'ls /etc' . split (), stdout = subprocess . PIPE ) grep = subprocess . Popen ( 'grep ntp' . split (), stdin = ls . stdout , stdout = subprocess . PIPE ) ls . stdout . close () output = grep . communicate ()[ 0 ] ls . wait () grep.stdin.close() is called by grep.communicate(). Another way to write it: grep = Popen ( 'grep ntp' . split (), stdin = PIPE , stdout = PIPE ) ls = Popen ( 'ls /etc' . split (), stdout = grep . stdin ) output = grep . communicate ()[ 0 ] ls . wait () As you can see, declaration order of commands in pipe doesn't matter. Alternative to communicate function Instead of grep.communicate() function you can use grep.stdout.read(). But first you have to wait for end of subprocess call: >>> grep . wait () >>> print grep . stdout . read () Although this way have one disadvantage. It moves file pointer do the end of file. So every subsequent call will return empty string: >>> grep . wait () >>> print grep . stdout . read () ntp-restrict.conf ntp.conf ntp_opendirectory.conf >>> p2 . stdout . read () '' Further more this has one more disadvantage. If you first wait() and then read() a program that produces a lot of output (more than 4 kilobytes), you'll get a deadlock. Special thanks to Marius Gedminas , J.F. Sebastian for help with this article.","tags":"Programming","loc":"http://kendriu.com/how-to-use-pipes-in-python-subprocesspopen-objects","title":"How to use PIPE in python subprocess.Popen objects"},{"text":"About notifications I like jenkins very much. If you will make mistake, he can tell you where you were wrong. Now here's the catch, if you don't visit jenkins enough, he is not helpful at all. But you can do something about it. This is the moment, where notification plugins comes to safe the world. Jenkins is known from reach variety of plugins. One type of them serves for notification about jobs status. But what if none of them are installed in your jenkins? What if you don't have rights to install any. Moreover your admin is asshole and you try to avoid him. Well, then I have solution for you. If you have Mac, please meet \"Jenkins Jr\". Jenkins Jr Idea is simple. You install \"Jenkins Jr\" and he checks in your name status of jobs. If status changes, you receive pleasant notification in Mac way. Here how you setup - step by step. Installation Installation is easy, because Jenkins Jr is in App Store . After installation, start Jenkins Jr. It should be visible as icon in tray. Setup First of all you have to add jobs to watch. To do that, you will need to copy url of jenkins job: Paste copied url into Jenkins Jr ( Settings -> Add ): In \"Add\" dialog box, you have also place for login and password to jenkins. If you want Jenkins Jr to start up after every login, you have to add it to Login Items in your account settings. To do that go to System Preferences -> User & Groups -> <Your Account> -> Login Items and add it from Applications folder. How it looks As I said, Jenkins Jr uses standard Mac notifications. After each job run, you will see notification in upper right corner about build status: You can see all notifications in Notifications area: If you click on one of them, it will open view of finished build in your browser.","tags":"Programming","loc":"http://kendriu.com/jenkins-jr-jenkins-notifications-for-mac","title":"Jenkins Jr – Jenkins notifications for Mac"}]}