Posts from 2013-12

Extract list of classes being used in legacy java project

posted on 2013-12-28 09:55:59

Currently I am working with a small sized legacy code base. To get a better overview, the actual LOC (lines of code) might be of interest:

# all lines including the whitespace
time \grep '.*' * -rc | cut -d ':' -f 2 | paste -sd+ | bc

Stripping the blank lines is left as an exercise to the reader.

This is ugly, but blazingly fast. time is just in there to see how fast things actually are.

Also a sorted list of all self-defined classes might make for a handy overview:

ack -h 'public class' | sed -e 's/^\s*//g' | cut -d " " -f 3-5 | sort | sort -k 2,3

Do yourself a favor, and use ack instead of grep. Nothing to regret in 99% of all use cases...

Installing emacs 24.3 on Fedora 19

posted on 2013-12-28 00:56:42

Installing emacs under one of the latest fedora releases is a bit of an act.

First, as of 12/2013 the newest version in yum is 24.1. If you are happy with this, then you are fine. If you need helm... things are different since it needs a recent emacs version, but at least 24.3. Would only be half a funny, if this one wasn't the newest you can possibly get.

Anyway, get the download from the homepage here, and let the games begin!

If you chose one with this funny new .xz ending, unxz emacs-24.3.tar.xz followed by a tar -xf emacs-24.3.tar will do. (bzip will be deprecated for exchanging kernel files beginning 2014, it seems, so xz will stick.)

When trying the magic ./configure, make, make install triplet the configure step will fail with this message:

configure: error: The following required libraries were not found: libXpm libjpeg libgif/libungif libtiff Maybe some development libraries/packages are missing? If you don't want to link with them give --with-xpm=no --with-jpeg=no --with-tiff=no as options to configure

Solution is to install all these lib's -devel files. (At least I did, so I could run the regular ./configure step without disabling anything.) Seems to be fine, if you have either libgif or libungif. I was missing the first one, but that did not pose a problem.

Afterwards, if you try configure right again, it will tell you this:

configure: error: The required function `tputs' was not found in any library. The following libraries were tried (in order): libtinfo, libncurses, libterminfo, libtermcap, libcurses Please try installing whichever of these libraries is most appropriate for your system, together with its header files. For example, a libncurses-dev(el) or similar package.

Install ncurses-devel, make, make install and the newest emacs will be glad to be of service, after about the while it took to write this. :o)

Vim colorcolumn fix

posted on 2013-12-13 23:08:23

Vim's got the possibility to show a colored vertical line in your editor a certain character spot.


Put this command in your .vimrc to enable this. cc is shorthand for colorcolumn. This basically is just a graphical reminder at column 81 for you to break your lines, and is shown across all lines.

If instead you just want to have markers shown when you actually have to long lines, use this:

call machadd('ColorColumn', '\%81v', 100)

Now the highlighting is only present in lines actually being too long.

"git commit <commitmessage>" without quotation marks

posted on 2013-12-09 23:05:46

Using git exactly how you want it to, is best done from within a shell. (At least in my former experiences, maybe the git clients improved vastly by now?)

EGit (the eclipse plugin), SmartGit, the Github clients all did not satisfy me. Eiter the clients lacked functions (which were needed and I was back to commandline anyway) or the functions did not behave as expected: Changing files permissions, but nothing otherwise, failing merges that were completely doable in vanilla git, ...) I have had my share, especially with EGit.

But typing 'git commit -am "this is my commitmessage"' gets old over time, too.

A way to fix this is to put this in your .bashrc:

function gc { git commit -am "$*" }

If you use another shell, you might want to put it in whatever initialization file gets executed upon shell startup. On a Mac, you might want to remember this difference to usual linux.

This will make for a nice shortcut:

$ git commit -am "this is a long commit message and i do not want to type the quotation marks"

# NEW (I have 'gc' as memo for 'git commit', choose as you like.)
$ gc so this works now without quotation marks

This has to be done through a bash function, with an alias definition it will not work. Of course you can define bash aliases for other git commands you use more often (You bet I did. Actually a ton if it, considering you much I use git nowadays.).

Somewhere in the bash manual it is said to be written [that you should prefer functions over aliases]. Got not linux at hand (cygwin at this moment) and no bash manual for grepping here, so you have to look it up yourself in case you do not trust my hearsay.

This blog covers .csv, .htaccess, .pfx, .vmx, /etc/crypttab, /etc/network/interfaces, /etc/sudoers, /proc, 10.04, 14.04, AS, ASA, ControlPanel, DS1054Z, GPT, HWR, Hyper-V, IPSEC, KVM, LSI, LVM, LXC, MBR, MTU, MegaCli, PHP, PKI, R, RAID, S.M.A.R.T., SNMP, SSD, SSL, TLS, TRIM, VEEAM, VMware, VServer, VirtualBox, Virtuozzo, XenServer, acpi, adaptec, algorithm, ansible, apache, apache2.4, apachebench, apple, applet, arcconf, arch, architecture, areca, arping, asa, asdm, autoconf, awk, backup, bandit, bar, bash, benchmarking, binding, bitrate, blackarmor, blockdev, blowfish, bochs, bond, bonding, booknotes, bootable, bsd, btrfs, buffer, c-states, cache, caching, ccl, centos, certificate, certtool, cgdisk, cheatsheet, chrome, chroot, cisco, clamav, cli, clp, clush, cluster, coleslaw, colorscheme, common lisp, configuration management, console, container, containers, controller, cron, cryptsetup, csync2, cu, cups, cygwin, d-states, database, date, db2, dcfldd, dcim, dd, debian, debug, debugger, debugging, decimal, desktop, df, dhclient, dhcp, diff, dig, display manager, dm-crypt, dmesg, dmidecode, dns, docker, dos, drivers, dtrace, dtrace4linux, du, dynamictracing, e2fsck, eBPF, ebook, efi, egrep, emacs, encoding, env, error, ess, esx, esxcli, esxi, ethtool, evil, expect, exportfs, factory reset, factory_reset, factoryreset, fail2ban, fbsd, fdisk, fedora, file, filesystem, find, fio, firewall, firmware, fish, flashrom, forensics, free, freebsd, freedos, fritzbox, fsck, fstrim, ftp, ftps, g-states, gentoo, ghostscript, git, git-filter-branch, github, gitolite, global, gnutls, gradle, grep, grml, grub, grub2, guacamole, hardware, haskell, hdd, hdparm, hellowor, hex, hexdump, history, howto, htop, htpasswd, http, httpd, https, i3, icmp, ifenslave, iftop, iis, imagemagick, imap, imaps, init, innoDB, innodb, inodes, intel, ioncube, ios, iostat, ip, iperf, iphone, ipmi, ipmitool, iproute2, ipsec, iptables, ipv6, irc, irssi, iw, iwconfig, iwlist, iwlwifi, jailbreak, jails, java, javascript, javaws, js, juniper, junit, kali, kde, kemp, kernel, keyremap, kill, kpartx, krypton, lacp, lamp, languages, ldap, ldapsearch, less, leviathan, liero, lightning, links, linux, linuxin3months, lisp, list, livedisk, lmctfy, loadbalancing, locale, log, logrotate, looback, loopback, losetup, lsblk, lsi, lsof, lsusb, lsyncd, luks, lvextend, lvm, lvm2, lvreduce, lxc, lxde, macbook, macro, magento, mailclient, mailing, mailq, manpages, markdown, mbr, mdadm, megacli, micro sd, microsoft, minicom, mkfs, mktemp, mod_pagespeed, mod_proxy, modbus, modprobe, mount, mouse, movement, mpstat, multitasking, myISAM, mysql, mysql 5.7, mysql workbench, mysqlcheck, mysqldump, nagios, nas, nat, nc, netfilter, networking, nfs, nginx, nmap, nocaps, nodejs, numberingsystem, numbers, od, onyx, opcode-cache, openVZ, openlierox, openssl, openvpn, openvswitch, openwrt, oracle linux, org-mode, os, oscilloscope, overview, parallel, parameter expansion, parted, partitioning, passwd, patch, pct, pdf, performance, pfsense, php, php7, phpmyadmin, pi, pidgin, pidstat, pins, pkill, plasma, plesk, plugin, posix, postfix, postfixadmin, postgres, postgresql, poudriere, powershell, preview, profiling, prompt, proxmox, ps, puppet, pv, pveam, pvecm, pvesm, pvresize, python, qemu, qemu-img, qm, qmrestore, quicklisp, quickshare, r, racktables, raid, raspberry pi, raspberrypi, raspbian, rbpi, rdp, redhat, redirect, registry, requirements, resize2fs, rewrite, rewrites, rhel, rigol, roccat, routing, rs0485, rs232, rsync, s-states, s_client, samba, sar, sata, sbcl, scite, scp, screen, scripting, seafile, seagate, security, sed, serial, serial port, setup, sftp, sg300, shell, shopware, shortcuts, showmount, signals, slattach, slip, slow-query-log, smbclient, snmpget, snmpwalk, software RAID, software raid, softwareraid, sophos, spacemacs, spam, specification, speedport, spi, sqlite, squid, ssd, ssh, ssh-add, sshd, ssl, stats, storage, strace, stronswan, su, submodules, subzone, sudo, sudoers, sup, swaks, swap, switch, switching, synaptics, synergy, sysfs, systemd, systemtap, tar, tcpdump, tcsh, tee, telnet, terminal, terminator, testdisk, testing, throughput, tmux, todo, tomcat, top, tput, trafficshaping, ttl, tuning, tunnel, tunneling, typo3, uboot, ubuntu, ubuntu 16.04, udev, uefi, ulimit, uname, unetbootin, unit testing, upstart, uptime, usb, usbstick, utf8, utm, utm 220, ux305, vcs, vgchange, vim, vimdiff, virtualbox, virtualization, visual studio code, vlan, vmstat, vmware, vnc, vncviewer, voltage, vpn, vsphere, vzdump, w, w701, wakeonlan, wargames, web, webdav, weechat, wget, whois, wicd, wifi, windowmanager, windows, wine, wireshark, wpa, wpa_passphrase, wpa_supplicant, x11vnc, x2x, xfce, xfreerdp, xmodem, xterm, xxd, yum, zones, zsh

Unless otherwise credited all material Creative Commons License by sjas