Technitribe

interesting problems (and a few solutions, too)

Technitribe
  • About the Authors
  • Log In
  • Log Out
  • Lost Password
  • Register
  • Reset Password
    • 9 Jul 2015

      Eclipse Content Assist Colors

      Written by Alex Wood

      When I write Java, I use Eclipse.  It does what I need it to do, but there are a few things about it that bother me.  One of them is that Eclipse allows very limited control over the color scheme.  Most of the color settings are inherited from the desktop theme that you’re using.  I recently upgraded to Fedora 22 and with the Adwaita theme under XFCE, this is what the Eclipse content assist dropdown looks like:

      Can you read the top selection?

      Can you read the top selection?

      Notice how close the foreground and background colors are for the selected item.  I find that intolerable.  I’m not sure exactly why Eclipse is picking that color combination, because the content assist object is a GtkTreeView which has the selected item background color set to cerulean blue in Adwaita.  In any case, to fix it create ~/.config/gtk-3.0/gtk.css with the following contents:

      
      GtkTreeView:selected {
          background-color: @theme_selected_bg_color;
      }
      

      That snippet will override whatever weirdness is going on with the content assist dropdown and set the background color back to the theme’s default background color for selected items. You can also just set it to a hex value. Note that this setting will apply to any GTK3 application, but that should be all right since you’re just asking the theme to do what it is already doing.

      4 Comments
    • 2 Jul 2015

      Bootstrapping a DevOps Movement in Red Hat IT – Video

      Written by Tim Bielawa

      Back in late 2013 I joined what was jokingly referred to as the Red Hat IT “DevOps” team. We didn’t like that name, so we changed it and there-after became officially known as Team Inception. From the time the team was formed, we all accepted that the team was to retire in 18-24 months. We were totally cool with that too! To us having a pure “DevOps” team in perpetuity just didn’t make sense.

      Over the course of the team’s lifespan I feel like I experienced incredible growth, both personally and professionally. I’m proud to look back at all the cool things we accomplished as a team, and I’m even more thankful to have had the opportunity to be a member of that team. Here’s a taste of some things we did as a team publicly:

      • Blogged a bunch of posts for Red Hat Developer Blog
      • Created a functioning Continuous Deployment system, Release Engine [Docs]
      • Created jsonstats, a tool for exporting system information over a REST interface
      • And another tool, Talook, which provides a view into jsonstats running on a collection of servers
      • Cacophony, a simple REST API for automatic SSL certificate generation
      • The Ansible XML module. This grew in popularity so much that we realized the best way to ensure it lives on was by transferring complete ownership over to Chris Prescott, a former contributor (Thanks Chris)!
      • git-branch-blacklist – A git-hook based system for blacklisting pushes to specific branches

      Two week ago (2015-06-20 → 2015-06-24) the DevNation and Red Hat Summit 2015 conferences were held in Boston, MA. Of the many excellent speakers and panel groups [S|D] that held sessions during the conferences, there’s one group I am especially fond of: My old team, Inception.

      On Wednesday, July 24th we held a panel session called Bootstrapping a DevOps Movement in Red Hat IT. This was our final activity together as Team Inception. During this panel-style session Jen Krieger, our Product Owner/Scrum Master, facilitated a look back at some of our experiences during our 18 months as the Red Hat IT “DevOp Team”.

      We began the initial round of questions with what our individual perceptions of “DevOps” were before the team had formed. We followed that with what ended up being a great Q&A with the audience (thank you everyone who participated!). We ended the panel with our closing thoughts on what “DevOps” means to each of us now.

      Here’s a snippet from the official session description:

      Topics will include

      • What we accomplished. We’ll take you step-by-step through how we deliver our work using a combination of open source tools, including Docker.
      • How we rate both our cultural and tooling success.
      • Roadblocks, disruptions, and surprises we encountered and how we handled them.
      • How this project has changed the way we view our jobs and our work relationships.
      • What’s next for the team.

      Panel

      • Tim Bielawa, Release Engineering / Development
      • Ryan Cook, System Administration
      • Steve Milner [blog], Security / Development
      • Chris Murphy, System Administration

      Panel facilitator

      • Jen Krieger [pinterest], Agile Coach & Original Inception Product Owner

      Between ourselves, we casually referred to this as our final team retrospective, an honest (and very public) look-back at lessons learned over the last year and a half.

      Click play below to watch the full video now, or go directly to it on YouTube.

      And before I forget. So much thanks to Andrew “Hoss” Butcher [GH] for recording, editing, and posting the recording for us. I (we) owe you many Tasty Beverages for that.

      2 Comments
    • 2 Mar 2015

      Custom mappings for the Logitech R400 under Fedora 20

      Written by Alex Wood

      I wanted to use a Logitech R400 that a friend loaned my in a presentation, but I wanted to tweak the mappings for the buttons a bit. My presentation is done using Reveal.js and uses both left/right and up/down. The R400 has four buttons but two of them are mapped to “go to black screen” and “slideshow mode” neither of which is useful to me. Here is how I fixed it in Fedora 20.

      1. Create the directory /etc/udev/hwdb.d
      2. Write the following out to /etc/udev/hwdb.d/99-logitech-r400.hwdb
        
        # The lower left button actually emits two
        # different scancodes depending on the state of
        # the "presentation".
        # E.g. one code to start and one to stop.
        keyboard:usb:v046DpC538
          KEYBOARD_KEY_70029=up
          KEYBOARD_KEY_7003E=up
          KEYBOARD_KEY_70037=down
          KEYBOARD_KEY_7004B=left
          KEYBOARD_KEY_7004E=right   
        

        This maps the left and right buttons to left and right, the both states of the slideshow button to up, and the blank screen button to down. The 046D is the Logitech vendor code and the C538 is the model number. Those magic numbers after “KEYBOARD_KEY” are the scancodes associated with the button. Supposedly showkey --scancodes will display them but I couldn’t get that to work and ended up taking them from another blog post.

      3. Now we need to load this information.
        
        # udevadm hwdb --update && udevadm trigger
           
      4. We can test by running the command below and pushing the buttons
        
        # xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
        
      5. Everything should work now, but if we unplug the USB receiver everything gets reset. That’s annoying so we will fix it
      6. Write the following to /etc/udev/rules.d/99-logitech-r400.rules
        
        SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c538", IMPORT{builtin}="hwdb 'keyboard:usb:v046DpC538'", RUN{builtin}+="keyboard"
        

        That will import our custom mapping when the USB receiver is plugged in.

      Thanks to the following who helped me figure all this out:

      • Tweaking the Logitech R400 presenter tool on Linux by Derrick Rethams
      • udevadm
      • Udev – Crashcourse Wiki
      • How to create custom keymaps now that libudevkeymap is gone
      • Writing Udev Rules by Daniel Drake
      0 Comments
    • 13 Nov 2014

      Inspecting Spec Files

      Written by Alex Wood

      In my experience, the best way to learn about how to package RPMs is to look at how other people package RPMs. That means looking at lots of spec files. Sure fedpkg will let you clone lots of package repos, but what if you only have the SRPM? You can get the spec file out of a SRPM, but it takes a little work with cpio, a tool with so many options that I can never remember the exact invocation. So I wrote a quick two-liner to save me some aggravation:

      #! /bin/sh
      spec=$(rpm -qlp $1 | grep -E '\.spec$')
      rpm2cpio $1 | cpio -i --to-stdout $spec

      And how can you get the SRPM? Simple, install yum-utils then run

      $ yumdownloader --source --downloadonly PACKAGE_NAME
      2 Comments
    • 4 Nov 2014

      Repoquery for mock

      Written by Alex Wood

      I use mock frequently when I am building packages for Fedora. Koji is great, but mock really shines when you are rapidly iterating over spec file changes. The --no-clean option keeps the chroot around so you don’t have to download packages repeatedly and you can actually look around inside the chroot to see where a build is going wrong if you need to.

      I also use repoquery a lot to see what a package requires or provides. Knowing what a package requires or provides is especially helpful when you’re doing builds. By default repoquery runs against the repos in /etc/yum.repos.d. Wouldn’t it be nice if we could run repoquery against the repos set up in our mock configs?

      It turns out that you can. Repoquery takes a --repofrompath argument that can be used to create an ad hoc repo to query. The only missing piece is reading the mock config, grabbing the repo URL, and formatting it.

      I wrote a little Zsh function to do just that.

      #! /bin/zsh
      
      mock-repoquery() {
          local profile="$1"
          [ -f "$profile" ] || profile="/etc/mock/${1}.cfg"
      
          # Take all baseurls in a file and make them into an array
          # See Parameter Expansion Flags section of the zshexpn man page and
          # http://unix.stackexchange.com/a/29748
          local repo_urls
          repo_urls=("${(@f)$(sed -n -r 's/.*baseurl=(.*)(\\n|$)/\1/p' $profile | cut -d'\' -f1)}")
          local repo_args
          repo_args=()
          for ((i=1; i <= ${#repo_urls}; i++)); do
              repo_args+="--repofrompath=r${i},$repo_urls[i]"
              repo_args+="--repoid=r${i}"
          done 
          repoquery "${repo_args[@]}" "$@[2,-1]"
      }
      
      mock-repoquery "$@"
      

      Drop the above code into ~/.zfunc/mock-repoquery and then add the following to ~/.zshrc

      fpath=( ~/.zfunc "${fpath[@]}" )
      autoload -Uz mock-repoquery
      

      Then you can use mock-repoquery by passing a mock profile as the first argument. Any additional arguments will be forwarded to repoquery. For example:

      $ mock-repoquery /etc/mock/fedora-20-x86_64.cfg --requires tig
      git
      libc.so.6(GLIBC_2.15)(64bit)
      libncursesw.so.5()(64bit)
      libtinfo.so.5()(64bit)
      rtld(GNU_HASH)
      

      Note that mock-repoquery will only work in Zsh due to my usage of Zsh parameter expansion. Converting this function to work in Bash is possible, but I use Zsh so I didn’t bother. Patches will be accepted happily!

      0 Comments
    • ←
    • →
    Page 2 of 4
    • The Authors
    • Virtual Disk Guide

      Interested in virtualization? Do QCOWs rule your filesystem? Are you a libvirt or KVM+QEMU wizard? I wrote a book about virtual disk management. Check out the The Linux Sysadmin's Guide to Virtual Disks online for free at ScribesGuides.com.


      Consider supporting the author by purchasing a hard copy of the first edition for just $10.00 on Lulu.com.

    • bitmath

      bitmath is a Python library for dealing with file size units (GiB's, kB's, etc) in a sane way. bitmath supports arithmetic, rich comparison, conversion, automatic best human-readable representation, and many other utility functions. Read some examples on the docs site or check out the source on GitHub.

    • latest posts

      • Using jq to filter an array of objects from JSON September 9, 2019
      • Two Year Break — And we’re back! November 16, 2018
      • [Updated] GitHub + Gmail — Filtering for Review Requests and Mentions January 20, 2017
    • tags

      bitmath blog conference css dblatex DNS DocBook eclipse Emacs Erlang Fedora fedora 22 filter GNU Screen Haiku Introduction java jboss LCSEE Linux locale locales fix slicehost ubuntu Macports module nist nXML-Mode opengl open source OS X package packaging pki prefix units presentation project pypi Python scholarship si summit Tutorial ubuntu xcode XML XMPP
    • h4ck teh world

      tbielawatbielawa

    Creative Commons License
    Technitribe by Tim Bielawa is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.