Yes this is already stale news for most of you, I guess, but here it is: Apple registered a patent for a key-less keyboard.
How to go from this…
… to this?
We will be changing your
.bashrc file. It is located in your home.
- Make a save of your
.bashrcfile (one is never too careful;
cp -p .bashrc .bashrc.sav).
- Optional step: make your prompt colored by uncommenting the highlighted line:
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
- Now locate the last line of the following excerpt and edit the previous lines accordingly to the following line:
# Add git branch if its present to PS1
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
if [ "$color_prompt" = yes ]; then
unset color_prompt force_color_prompt
- Restart your prompt, you’re done.
Something more detailed
For programming or writing, we use a keyboard. Most of times, we use the layout common in our area (QWERTY in English-speaking countries, AZERTY in France, QWERTZ in Germany, …). Some more advanced users sometimes look in alternative layouts (e.g. Dvorak), but finding the best fit in this jungle without being wronged by what’s fashionable can be difficult.
I just tumbled on a Keyboard Layout Analyzer which, from some sample text you input, analyzes which keyboard layout would be best for you.
For instance, I tried with the source for My latest entry and the analyzer tells me that, to write my English Markdown text, Colemak is the best fit (Colemak is an alternative layout for English, 3rd just behind QWERTY and Dvorak). And AZERTY, my usual layout, is the worst…
The fun facts are interesting: in the “Miscellaneous” tab, you can see I had to use the Alt Gr key 72 times. On any layout other than AZERTY, I would not even have touched it once. Heat maps gives a pretty good idea of the finger moves you’ll have to make, too.
There are limitations nonetheless: only six layouts are available, namely QWERTY, AZERTY, Simplified Dvorak, Programmer Dvorak, Colemak and Personalized (I don’t know this one, maybe a specific built for the author’s own needs?). I dare not test one of my French texts as input, though I would have loved to see BÉPO and French Dvorak ranked against AZERTY.
So, what’s your best fit?
Most of us use computers on a daily basis. We are so used to them we take almost everything around them for granted. Even the shape of the keyboard.
Damn, we are so familiar with this shape we even use this keyboard on smartphones! The younger ones do not even know where this shape comes from (some of them are curious enough to wonder).
How was the QWERTY layout (and all others) created? And why are the columns shifted from a row to the next?
How it works
The script will copy the original directory (or single file) and leave it untouched, while removing any useless space and comments from any .htm, .html, .php, .css and .js file in the copy.
Running the script
chmod 755 deploy.sh
./deploy.sh <source> <target>
If the target already exists, it will be removed first (you will need to confirm).
Much is transparent or commented. The minification is the only really interesting part. So let’s go at it!
Basically, the minification is all done here:
echo "Minify file $1"
perl -pi -e "s#(?:^[ \t]+|[ \t]+$)##g" "$1" # leading & trailing spaces
substitute_escape_strings "//.*" "" "$1" # remove //-style comments
perl -pi -e 's#(?:\r?\n)+# #g' "$1" # new lines
substitute_escape_strings "<!-- .*?-->|/\*.*?\*/" "" "$1" # remove multiline comments
substitute_escape_strings "[\s]+" " " "$1" # make multiple spaces single
perl -pi -e "s#(?:'[^']+'|\"[^\"]+\")(*SKIP)(?!)|$1#$2#g" "$3"
This code is commented and should not require more than is already said.
Now, the essential enhancement I made since the sed era is the removal of all comments and correction of my code to remove all new lines.
I abandoned sed and went to Perl because sed does not support the non-greedy operator, which greatly simplified my work when removing delimited patterns (typically multiline comments).
Getting the full script
It is available on Github. Don’t hesitate to fork and make it better.
Note: the competition
There is none: this is not a tool I would recommend in production environment (for lack of test, for instance).
Why this script is good
It is a quick fix for simple and mostly static websites. It removes potentially sensitive information (many website have their .git repository deployed, containing everything in it, and comments can be a source of leak too, be it only be advertising the technology behind the scenes).
Why this script is bad
I needed something working quickly and without effort. This is it.
You can use it on your server to automatically deploy the latest version of your website. Imagine:
# Ensure the deploy script is up-to-date
# Update the site
./website-deploy-script/deploy.sh my-wonderful-site /var/sites/www/my-wonderful-site
echo "Deployment complete, site is up-to-date!"
We will take an example: match all
- Write the regex for what you want to match (later called
m; our example:
- Write the regular expressions for matching your exclusions (later called
e3; our example:
- Write your final regex:
- Match group 1 instead of matching group 0.
Note: This requires code to parse the result. If you need something simple (sed? Which you would replace with a Perl command? Or just something you can use with
match), see below.
Regex #2: alternative for Perl and PCRE (PHP)
- Write your final regex:
- Match group 0 as usual.
Note: You can execute this expression as a Perl command:
perl -pe '(?:\'[^\']+\'|"[^"]+")(*SKIP)(?!)|/\*.*?\*/'
You can test the regex and have it explained at this link.
Something more detailed
I’ve been meaning to do this for a long time and now the time has come: KeyboardPlaying has a new logo. Which means it will soon have a new website too.
You can find it on Github. Fork if you have any way to make it better (either better looking or just a better construction of the SVG).
Now, this lays the foundations of the future graphical style of the website. The colors were inspired from the Material Design Lite, which I’ll use for the next version of the homepage. It is also flat as I like the current trend to minimalism and flatness. I find it much more soothing than all the fashion of imitating reality, making things 3D like with shadows and so on (though I loved it in that time too, but I was a bit younger; time to be an adult… Or maybe not totally).
No, for the website, just a bit of patience, please.
Why, oh why?
I am a consultant developer. This means I move from client to client and share their time constraints. This includes deadlines, but also work time.
It so happens that some clients have a time clock, like in the old days.
My problem is: while most of my client’s employees can see what the clock stores, I, as an extern, cannot. I do not like to be blind, so each time I am in this situation, like many people I know, I make an Excel sheet where I log my check-ins and -outs.
Sharing my timesheet…
On my latest mission, we were several on the team from the same company. I spent some days without my usual timesheet and when I grew tired, I sent my first basic version, with some conditional formatting, to all members there.
Since they did not seem very interested if I asked whether something standard was available, I did not expect much. But instead, I quickly got some feedback: they asked new features, signalled some bugs, …
The team grew, the requests followed. The possibilities of the timesheet were ever greater, and therefore so was its complexity.
… with the whole world
Finally, using e-mails to track the feedback and release the changelog and user manual became too heavy. I thought of a bug tracker. This led me to create a Github repository. The wiki would come in handy for the user manual too.
Thus the work on version 2, which should make the sheet less specific to our context and more widely usable, began.
And now version 2.0 is here!.
Choosing the format for storing revisions of the timesheet
The choice of using Excel for the timesheet comes with a consequence: the file we edit is a binary. We know one thing about GIT (and most RCSs) is that it is not that efficient with binaries.
But we also know that a .xlsx file is just a zip of XML files, so we chose to save it as the exploded version of the .zip file.
The only thing we lacked was a way to easily switch to and fro between both forms.
Searching for the tool
I ambitioned at having one script that could be used with an argument to do this. It is easy in Unix. I even found a solution using PowerShell for Windows. But this required to maintain two scripts.
But all these are oriented towards a specific technology and all of them require to install something on your computer.
Making the tool…
I am a developer after all, and this is within my area. So I went for an executable .jar. Only thing you need to have on your computer? An up-to-date version of Java.
And I came up with a basic Swing interface.
It may not look like much, but it does the job…
… and enhancing it
… and it will do more.
Do not hesitate to head over to the repository and fork it to tailor it to your own needs or make this one better.
In the end, it will make developing the xls-time-tracker timesheet and managing its versions easier.
Just wait and see…
When you are a coder, you use a monospaced font. But finding one easy on the eyes is not that easy.
Andreas Larsen did his best to find a solution and he has come with something pretty interesting. In a few keywords, it is clean, sharp, a bit geeky, …
With more words:
- It does not have Courier’s serifs.
- Every character is easily recognizable. In Java for instance, you need to be able to distinguish without mistake an
0, or an
1. After all,
421are not the same thing at all. Riddles are based on this single possible confusion.
- The character spacing is smaller than the usual, allowing to see more on your screen when you have long code lines (which I do not recommend though).
- It’s Open Source and alive, with a Github project, issues and therefore the chance for the people who use it to make it better over time.
- Purely geeky: it comes with funny ligatures. Take a look at the HTML comments in the sample below.
- Edit (2015-08-01): The authors have integrated FontAwesome as ligatures into a variant of Monoid called Monoisome. Useful when you develop web projects with FontAwesome.
- Tailored to your preferences: you can download it with different line height, character spacing, with or without ligatures, …
This takes the place of Ubuntu Mono as my favorite monospace font for coding. Way to go, Monoid!
Go to the Monoid website to download it.
Source: Found via Lifehacker
Remember the Optimus, right? A keyboard with a screen for each key, thus allowing for full customization, changing layout, displaying icons, and so on. But in the end, it never got out. Only ever-delayed.
The concurrence may finally be out: an Australian company answers to the Russian concept with something similar, using e-Ink instead of more traditional screens.
Backlit, customizable, … Just fine…
(via Clubic [FR])