Fast translation with Google Translator

March 7, 2016

via https://medium.com/@mrdoro/fast-translation-with-google-translator-and-mac-osx-817e32233b7a


Nice article about how to create a service to automatically translate selected text from any application. I use this all the time, I have a “German-to-English” service bound to Command-Alt-Ctrl-Shift-E, so I can just select text off the screen, press the shortcut, and a window with the translation will pop up. Very handy.

Moving files between git repositories, preserving history

April 17, 2015

I needed to copy a directory between two git repositories while preserving its history. I found some good instructions at http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/, which got me started, but I figured out a way to avoid having to move all the files into their directory again (lines 5-6 in Greg’s instructions) by reversing the filter to remove everything I don’t want instead of only including the directory I want. Here are the steps (the idea is the same as in Greg’s post, so please read that to get the explanation, I’m only listing the commands here for reference):

Find all single-note tags in Evernote

January 14, 2015
I’ve been working on cleaning up my Evernote, and noticed that I have a lot of tags assigned to a single note. I had successfully used Veritrope’s excellent Evernote empty tag remover applescript, so I made some small changes to write the attached script, which will find all single-note tags in your Evernote and list them in a new note, including links to each note. This makes it much easier to go through them and see which of those tags could be removed.

Just download the script, open it in Script Editor and run it.

Tip of the hat to Justin for his excellent collection of scripts at Veritrope!

(*
Evernote -- Find all single-note tags
January 13, 2015, Diego Zamboni
http://zzamboni.postach.io/find-all-single-note-tags-in-evernote
Based on:
http://veritrope.com
Evernote -- Empty Tag Remover
http://veritrope.com/code/evernote-empty-tag-remover
*)
set output to {}
tell application "Evernote"
try
set theTags to every tag
repeat with theTag in theTags
set theNotes to {}
set theName to "\"" & name of theTag & "\""
set theNotes to (find notes "tag:" & theName)
if (count of theNotes) is 1 then
copy ((name of theTag) & ": " & "<a href='" & (note link of (first item of theNotes)) & "'>" & (title of (first item of theNotes)) & "</a>") to the end of output
end if
end repeat
end try
set sortedTags to my simple_sort(output)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to "<br>"
set articleList to sortedTags as text
set AppleScript's text item delimiters to oldDelim
set o to create note with html articleList title "Single-note tags"
open note window with o
end tell
--SORT SUBROUTINE
on simple_sort(my_list)
set the index_list to {}
set the sorted_list to {}
repeat (the number of items in my_list) times
set the low_item to ""
repeat with i from 1 to (number of items in my_list)
if i is not in the index_list then
set this_item to item i of my_list as text
if the low_item is "" then
set the low_item to this_item
set the low_item_index to i
else if this_item comes before the low_item then
set the low_item to this_item
set the low_item_index to i
end if
end if
end repeat
set the end of sorted_list to the low_item
set the end of the index_list to the low_item_index
end repeat
return the sorted_list
end simple_sort

How to solve truncated docker output in Mac OS X using boot2docker

May 12, 2014

If you are using docker on Mac OS X using boot2docker (http://docs.docker.io/installation/mac/), you may see truncated output from docker run, and also may have noticed that docker attach does not work properly, producing only some output and then exiting. This bug is documented here: https://github.com/boot2docker/boot2docker/issues/150, where I also found the following workaround. Documenting it here in case anyone finds it useful:

Instead of using the default value of DOCKER_HOST provided by boot2docker up, establish the docker connection through an ssh tunnel:

Installing cfengine on Mac OS X

August 5, 2011

Cfengine (tested 3.2.0) installs easily on OS X (tested 10.7), given that it's Unix. One problem I encountered was that it does not compile with the bundled version of Berkeley DB (it recognizes it during configure, but produces compilation errors). The solution is to use some other DB engine. I chose Tokyo Cabinet. Using homebrew, the process is simple

brew install tokyo-cabinet

After this, configure --with-tokyocabinet, and then compile and install as usual.

Automatically creating tasks from email in Outlook

March 16, 2011

Please note: I am no longer using Windows nor Outlook, so unfortunately I cannot offer any help with problems you encounter using these scripts and techniques.

Over the last few days I have been redoing my GTD-under-Outlook setup, based on the instructions available in the "GTD and Outlook" guide from DavidCo (I will write more about my setup later). One of the tricks the guide suggest is creating a mail rule on outgoing mail, which scans the message body for a special tag (/wf or *wf* are suggested) and automatically adds the message to the @WAITING FOR email folder.

image from Automatically creating tasks from email in Outlook

Making cygwin, Windows and emacs understand the same symlinks

September 28, 2010

Today I ran into the problem that symlinks created under cygwin using "ln -s" are not understood by Windows, and of course Windows shortcuts are seen by cygwin as regular files. Happily, this is a (semi-)solved problem. For reference, this is what needs to be done:

  1. Add "winsymlinks" to your CYGWIN environment variable. For example, in my .bashrc I have the following:

    export CYGWIN="nodosfilewarning winsymlinks"

    This makes cygwin create symlinks differently, in a form that is understood both by it and by Windows.
    This is the main step, and the only one if you just need access from the shell and from the Windows explorer. However, emacs still sees those symlinks as regular .lnk files. To fix this, follow the next step.

Installing cfengine on Windows 7 under cygwin

August 23, 2010

Update (2011/09/05): Updated the instructions for cfengine 3.2.0, cygwin 1.7.9, and tested them on a clean cygwin install.

Installing the cfengine community edition under Windows (the commercial version includes native Windows support) is fairly easy under cygwin, you just need to have the appropriate dependencies installed. Here’s how I did it.

Versions  

  • cfengine: 3.2.0
  • Windows 7 Enterprise SP1/64bit
  • cygwin: 1.7.9-1

Additional cygwin packages needed 

To install these, run cygwin’s setup.exe, search for each packages in turn, and install them. Make sure you agree to install any additional packages that are listed as dependencies (setup.exe will ask you about it).