Skip to content

Instantly share code, notes, and snippets.

Tamás Michelberger tmichel

View GitHub Profile
tmichel / project-template.sublime-project
Created Dec 1, 2019
Sublime Text 3 Rails+Rspec project config template
View project-template.sublime-project
"path": "/path/to/project",
"folder_exclude_patterns": [
tmichel / exif.go
Created Apr 10, 2019
Extract Exif info from an image
View exif.go
package main
import (

Keybase proof

I hereby claim:

  • I am tmichel on github.
  • I am tmichel ( on keybase.
  • I have a public key ASA8sv-0DFsLtpoBSeIrahfwWt3A1_VRicx0sQBktUYZcwo

To claim this, I am signing this object:

tmichel /
Created Jan 24, 2018
Disable annoying shift augmentation for ctrl+up and ctrl+down on macOS
/usr/libexec/PlistBuddy -c "set AppleSymbolicHotKeys:34:enabled bool false" ~/Library/Preferences/
/usr/libexec/PlistBuddy -c "set AppleSymbolicHotKeys:35:enabled bool false" ~/Library/Preferences/
/usr/libexec/PlistBuddy -c "set AppleSymbolicHotKeys:37:enabled bool false" ~/Library/Preferences/
# 34 and 35 might not exists. Add them.
/usr/libexec/PlistBuddy -c "add AppleSymbolicHotKeys:34:enabled bool false" ~/Library/Preferences/
/usr/libexec/PlistBuddy -c "add AppleSymbolicHotKeys:35:enabled bool false" ~/Library/Preferences/
# Restart your computer. Log out then log in did not work for me.
tmichel /
Last active Jan 17, 2018
Abbreviated path: keeping first letter of parent dirs
# Print $PWD where parent directories are abbreviated to their first letters.
# $HOME is replaced with ~.
# Based on:
sed -e "s:$HOME:~:" -e 's:\([^/]\)[^/]*/:\1/:g' <<<$PWD
# PWD=/home/me/foo/bar/baz
# => ~/f/b/baz
tmichel / table_helper.rb
Last active Dec 29, 2017
Very simple table_for and attribute_table_for for Rails
View table_helper.rb
# Drop this into app/helpers and then in your views:
# <%= table_for(User.all) do |t| %>
# <% t.column :username %>
# <% t.column :email do |user| %>
# <%= mail_to %>
# <% end %>
# <% t.actions :show, :edit %>
# <% end %>
tmichel /
Created Sep 1, 2017
List files on the classpath with guava Resources
public static List<String> getFiles() {
String fixturesRoot = Resources.getResource("fixtures").getPath();
final Path fixturesRootPath = Paths.get(fixturesRoot);
try {
return Files.walk(fixturesRootPath)
.map(path -> fixturesRootPath.relativize(path).toString())
} catch (IOException e) {
tmichel /
Created Aug 28, 2017
Schema validation example
package io.sspinc.validator.example;
import io.sspinc.validator.Schema;
import io.sspinc.validator.ValidationErrors;
import static io.sspinc.validator.Validators.allowNull;
import static io.sspinc.validator.Validators.inclusion;
import static io.sspinc.validator.Validators.length;
import static io.sspinc.validator.Validators.presence;

Shell cheat sheet

Setting up iTerm

  • Use option as meta key:

Go to Preferences->Profiles tab. Select your profile on the left, and then open the Keyboard tab. At the bottom is a set of buttons that lets you select the behavior of the Option key. For most users, Esc+ will be the best choice.

  • Setting up word-by-word movement with Option+:
tmichel / search-engine.js
Created May 2, 2017
Mass remove Chrome search engines.
View search-engine.js
document.querySelectorAll('#other-search-engine-list > div.deletable-item').forEach(function(el) {
var url = el.querySelector('.url-column div.static-text');
if (url && ( url.textContent.match(/\.blog\.hu/) || url.textContent.match(/wordpress\.com/) )) {
var button = el.querySelector('.row-delete-button');
if (button) {;
You can’t perform that action at this time.