To list all the commit hashes in the whole history of a git repository:
git log --pretty=format:"%h"
To list all the files tracked a commit, run this:
git ls-tree --full-tree -r <hash>
If you’re only interested in the names:
git ls-tree --full-tree -r --name-only <hash>
If you want to completely remove a file from the history of a branch in git, do this:
git filter-branch --index-filter \
'git rm --cached --ignore-unmatch <file>'
I have started to learn go, Google’s system language. I really like it. I appreciate these features in particular:
- It is truly cross-platform, in par with java
- It has a huge standard library, again like java’s but without the GUI stuff
- It compiles to standalone executables that include the runtime! Imagine a JAR file that would carry a little JVM with it. No need to “install go” on a deployment machine!
In terms of design, it takes a little bit of time to get used to. But on the whole it is fairly easy and straightforward. I have a good knowledge of C, java, lua and bash and I had no problem to adapt to go.
These are the steps I took to build the sqlite JDBC driver so that it works on a musl-based Linux distro, namely Alpine Linux.
- Install a couple of dependencies:
# apk update && apk upgrade
# apk add git gcc make openjdk8 maven
# apk add perl curl unzip bash musl-dev
- Set up JAVA_HOME:
# export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
- Clone sqlite-jdbc repository:
# git clone https://github.com/xerial/sqlite-jdbc.git
- Build the shared object library and the JNI bindings:
# cd sqlite-jdbc
# make jni-header native
- Build the JAR (some tests don’t pass, you have to skip them):
# mvn -Dmaven.test.skip=true package
- The jar that is produced is in the target directory:
# ls target/sqlite-jdbc*
- To use it in a gradle build, mkdir a lib directory in your gradle project, copy into it the jar that was built as above and add the following compile line to build.gradle:
compile fileTree(dir: 'lib', include: '**/*.jar')
I have been using alpine linux images on docker for some time and until today, I have never encountered any problem.
What I am facing today is due to musl, the excellent glibc alternative used by alpine to keep the system very compact.
I have started to use sqlite as backend for simple lua applications and I liked it so much that I am now using it for my java/spring project as well.
To talk to it, I use the following JDBC driver: https://github.com/xerial/sqlite-jdbc
This driver is very efficient because it embeds a compiled version of the sqlite C library into its jar. So far so good, they provide shared libs for all operating systems and processors: from Windows 32bit to Linux ARMv7, MacOSX etc.
Even though the Linux libs cover all major processor architectures (Inter 32bit or 64bit and different ARM variants), they have something in common: they are compiled against glibc!
So this driver doesn’t work by default on alpine linux.
I have at least two solutions:
- Build it by hand (so I cannot draw it automatically from maven central)
- Use its pure java implementation (but then I sacrifice the nice performance offered by the compiled lib)
Anyway, this is not a showstopper for me using sqlite in Java, but it makes things a little bit more complicated.
Need a dummy SMTP server to test email sending?
Look no further than this, it fits the job perfectly!
This a short memo on how to print in colour in lua.
- Red: 31
- Green: 32
- Yellow: 33
- Blue: 34
Example, print “hello” in red:
lua -e 'print(string.format("\27[%dm%s\27[0m", 31, "hello"))'
On a chromebook, one can customise the terminal as follows. This is very handy used in conjunction with CLI crouton, to have a nice command line.
- Open the command line: Ctrl–Alt–T
- Enter a setting by typing: term_.prefs_.set(‘key’, ‘value’);
Possible keys with examples:
- Disable audible bell:
> term_.prefs_.set(‘audible-bell-sound’, ”);
- Hide scrollbar:
> term_.prefs_.set(‘scrollbar-visible’, false);
- Set background to solarized dark:
> term_.prefs_.set(‘background-color’, “white”);
- Set foreground to solarized dark:
> term_.prefs_.set(‘foreground-color’, “black”);
- Change font size permanently for all terminals:
> term_.prefs_.set(‘font-size’, 20);
- Change font size as one-off for current terminal:
Ctrl–+ or Ctrl––
- If you screw up and you want to start again:
Useful snippets ready to copy/paste:
Solarized Light colors:
Solarized Dark colors:
No scrollbar, no bell, decent font size:
You can find additional information on the crosh FAQ page.