Have you ever had a sub-select where you really needed to reference a value in the outer query? I know I have! The naive way would be to run the outer query and then loop over the results running the inner query on each one. Luckily, there’s a better way. The Correlated subquery. Check it out! The example given is
SELECT employee_number, name FROM employees AS Bob WHERE salary > ( SELECT AVG(salary) FROM employees WHERE department = Bob.department);
See how the sub-select references the outer query? It’s SQL magic.
This post is about renewing SSL certificates. There’s not a lot of information I want to communicate here, so I’m going to keep it short.
Yesterday the SSL certificate for
https://blog.lnx.cx expired. I don’t know much about SSL, other than I find it more confusing/complicated than most things. I knew that I needed to renew the SSL certificate for the blog, but I did not know what that exactly meant. When I called my cert provider on the phone to renew, they told me that the renewal process begins with submitting a new Certificate Signing Request, or
CSR in crypto parlance. We ended the call shortly thereafter and I set off to get started.
I still had questions though. If I’m “renewing” my SSL certificate, does that mean my existing certificate is involved in some way? When I began reviewing the CSR generation procedure I saw no references to existing certificates. I did a bit of Internet research to try and figure this out.
Eventually I found out that the idea of “renewing” a certificate is a bit of a misnomer. That is, nothing you have carries over with you. The process of “renewing” a certificate is actually the exact same process as getting an initial certificate. I’ll say that again for clarity:
Renewing an SSL certificate is the exact same thing as getting your first SSL certificate.
I hope this helps out other folks who are as confused as I was about the renewal process.
The “git archive” man page states:
git archive behaves differently when given a tree ID versus when given a commit ID or tag ID. In the first case the current time is used as the modification time of each file in the archive.
By using the current time in this case, git-archive is dooming all of our tarballs to have constantly changing SHA256 hashes. A lot of build systems, including Fedora’s Koji, rely on source tarballs maintaining a consistent fingerprint. What is a person to do?
Fix it of course! Below is a Python 2 program I wrote that addresses the issue. The code is well-commented (I hope) so you should be able to follow along. You give it the Unix timestamp you want the files to have, the git ref you want baked into the tar header, and the initial tarball. The result is printed to stdout so just redirect that to wherever you please (or pipe it into gzip). It also has some code in there to deal with tarballs created by the maven-assembly plugin, but it doesn’t surface that on the primitive CLI. I’m leaving that as an exercise for the reader I guess.
Recently I noticed that in my IRC client, when I right-click a URL and select “Open Link In Browser”, the system would open a new browser window (or tab if appropriate) but not pointed to the link I wanted to visit. It would just open the home page.
What gives? Well, I happen to know from experience that in Linux most programs that need to use a “default” type service of which there are many implementations (such as a web-browser) use the
xdg-open command. XDG associates different mime-types to default applications. Step one then is to figure out what’s going on with XDG.
% xdg-mime query default text/html firefox.desktop firefox.desktop
Here I’m asking XDG what applications are associated with the
text/html mime-type. Seeing two firefox.desktop files was a bit of a surprise. Let’s find out more!
% locate firefox.desktop /usr/share/applications/firefox.desktop /usr/share/xfce4/helpers/firefox.desktop
So I open up those two files and the first file looks normal and that file actually belongs to the Firefox package according to
rpm -qf. In the second file, I see
X-XFCE-Commands=%B -remote "openURL(about:blank,new-window)";%B; X-XFCE-CommandsWithParameter=%B -remote "openURL(%s,new-window)";%B "%s";
That looks strange to me. If I want to open a URL from the command line, I don’t use
openURL. Let’s see what happens if I replace that with
X-XFCE-Commands=%B; X-XFCE-CommandsWithParameter=%B "%s";
Aha! It works! But why? Well, after a little searching I came across Mozilla Bug 1080319. Looks like the
openURL was a legacy thing and got removed in Firefox 36. And a quick
rpm -q firefox confirms that I’m running that version. Firefox 36.0.1 add support for
openURL back in, but my hack will serve until that version hits Fedora.
Needs some tweaks on Gnome 3 though for better functionality
Explanation for having this:
By default, in GNOME3 every notification you recieve from weechat will stack up in your notification panel until acknowledged. This is not my idea of ideal. In libnotify, setting notifications to transient (see patch) means that they will not hang around on your notification panel forever — waiting for you to acknowledge them — one-by-one, before they disappear
/openalias, see the aliases section below.
Why not just click the links normally? Presumably, you’re running weechat in a terminal, this will cause long links to hard-wrap around the screen. When the links are hard-wrapped like this it causes the clickable portion of the URL to become truncated (you won’t be able to click the full url).
With this plugin you can use a simple command (within weechat) to launch links for you. The plugin watches your channels for text that looks like links and makes a note of them.
This has one obvious limitation: it doesn’t work well if you’re running weechat on a remote host, i.e., you have to ssh to the host you run weechat on. (But there are ways around that).
Alt + a
Alt + #
Alt + 5
See the next tip if you need to show a buffer whose number is two or more digits.
Alt + j ##
Alt + j 10
The current window will now display buffer number 10
Alt + h
Ctrl + N
Ctrl + P
This conflicts with the common
F11 = full screen idiom. Instead, lets leave
F12 as scroll down, but make
Shift + F12 scroll up.
/key bind meta2-24;2~ /bar scroll nicklist * y-100%
Enter it exactly as shown: with the tilde (
~) and semicolon (
WeeChat >= 0.3.5, terminal with 256 colors
Run the command in this link: http://lnx.cx/~tbielawa/blog/weechat_nick_colors.txt
/set irc.look.smart_filter on
/filter add irc_smart * irc_smart_filter *
/set irc.look.smart_filter_delay 5
If you want to see who has joined/left recently, press
ALT + = (alt and the equals key). Pressing it again rehides the notices.
You may have a problem where your buffer titles (channel topics) only color the bar to the end of their text. This is a configuration issue and the fix is documented on the weechat FAQ.
At work I am logged into three IRC networks all day long: devel, corp, and freenode, I use this to set a status (tbielawa|brb, or tbielawa|wfh, …) on all three at once:
/alias appendnick /allserv nick tbielawa|$*
Nick on all networks is now: tbielawa|wfh.
/alias cb /buffer close
If I have been disconnected (dropped off the VPN, or switched locations) and I need to reconnect to all my IRC networks I use this:
/alias rejoin /reconnect -all
If you’re using the
urlgrab.py plugin (above), this will open the last URL it found in your current channel:
/alias open /url 1
The last link sent in your channel will be launched in your browser.
Split weechat into three horizontally stacked windows:
/alias split3 /window splith 33; /window +1; /window splith
I don’t normally run this by hand, it’s actually a part of a more complex alias I run when I first open weechat. See
These will build off of some of the aliases we already setup in the “Basic Aliases” section.
/alias wfh /appendnick wfh
My nick would now be set to tbielawa|wfh on all logged in servers. Requires you made the
/appendnick alias already.
/alias lunch /appendnick lunch
My nick would now be set to tbielawa|lunch on all logged in servers.
/alias unlunch /allserv nick tbielawa
My nick would now be set back to ‘tbielawa’ on all logged in servers.
Ask the GCA bot in #it-eng to do a Figlet (Figlets are large ASCII text banners). This works no matter what channel you’re viewing presently, as long as it’s on the same irc network:
/alias fig /msg #it-eng gca: figlet $*
The phrase LOLCATS! will appear in a large ASCII font in the #it-eng channel.
This requires that you have three horizontally stacked windows open (see
/split3 above). It will cycle the focus through each window and then set it to display a specific buffer (channel).
Say for example you automatically join three channels when opening weechat: #it, #secretfunchannel, and #myteamchannel:
/alias mychannels /window up; /buffer #it; /window down; /buffer #secretfunchannel; /window down; /buffer #myteamchannel; /window up
When the alias finishes the cursor will be focused on the center buffer (channel), which in this example would be #secretfunchannel.
Final Window <-> buffer arrangement after running
Top <-> #it
Middle <-> #secretfunchannelhas the cursor focus
Bottom <-> #myteamchannel
I don’t actually run this alias directly (like
/split3, above). It is part of a more complex macro. See
Sets up your windows and what channels they display correctly when you start weechat. This will split weechat into three horizontally stacked windows, each showing a specific channel:
/alias startup /split3; /mychannels
/split3alias and the
/mychannelsalias, defined above.