![]() ![]() I merely made a custom bundle to support custom syntax highlighting and folding for KSP for my own(and now your) use. Also I am not affiliated with macromates (the developer of textmate). Please note that this post is not meant in any way to start a war in code editors, just my personal choice and my sharing it with the community. This is partly because it is/was ported into OS X not by Nils himself but by someone else. Users/pd/Library/Scripts/dict.py "$(shuf -n1 ~/WordLists/NOAD3rdED.txt)"Īlias dictrand='/Users/pd/Library/Scripts/dictrand.Like many of you I have been using Nils KSE editor for scripting however it does not work as good on OS X as it does on the PC (different line endings, problem with big scripts, slightly outdated etc.). If you create a shell script and name it something like dictrand.sh, and place an alias in your ~/.bash_profile as described in a previous post above for dict, you can just use the command name. You can also use Ruby, Perl, or Python which are all included in OS X.ĭict "$(shuf -n1 ~/WordLists/NOAD3rdED.txt)"ĭict "$(ruby -e 'puts $' ~/WordLists/NOAD3rdED.txt | head -1)"ĭict "$(python -c 'import random, sys print random.choice(open(sys.argv).readlines()),' ~/WordLists/NOAD3rdED.txt)" I prefer shuf, non-native to OS X, but which you can download as part of GNU Coreutils. You can then use a language and function of your choice. You'll first need to extract a word list from whichever dictionary you use. Tangentially, if you like to discover new words, you can look up words randomly in Dictionary on the command-line using dict.py, described in a previous post above, and command substitution. Via Latin from Greek rhinokerōs, from rhis, Genera and five species.] ORIGIN Middle English: Rhinoceroses) a large, heavily built plant-Įating mammal with one or two horns on the noseĪnd thick folded skin, native to Africa and Hippos ho potamios ‘river horse’ (from hippos Via Latin from Greek hippopotamos, earlier Water in West Africa.] ORIGIN Middle English: Liberiensis), frequenting forests near fresh Hippopotamidae: the very large HippopotamusĪmphibius, frequenting rivers and lakes, and the Thick-skinned semiaquatic African mammal, with Hippopotamuses or hippopotami || ) a large Odin: ~$ hiroto2.py hippopotamus rhinoceros 人 佛 Appropriate Dictionaries enabled in the Dictionary app preferences. Print '\n%s\n' % tuple( ] )Īnd the output on El Capitan 10.11.1 with Python 2.7.10 and standard Apple PyObjc scripting bridge. R = DCSCopyTextDefinition(None, q, (0, len(q))) or 'nil' # - manually loading fixed bridgesupport metadata Results from OpenThesaurus as a Service: How?īy the way, here's a revision of my script which incorporated textwrap feature inspired by Roote. How can I use Automator to extract substring of text based on pattern? Now those rubycocoa codes may be translated into pyobjc codes without much difficulty. Regarding amework, more comlpicated and finer queries are possible by using undocumented functions as shown in the following threads. It is indeed very good news that manual loading of bridgesupport metadata still works with recent pyobjc, for it opens straightforward door to undocumented framework functions without resorting to ctypes module. Tested with pyobjc 2.2b3 and python 2.6.1 under OS X 10.6.8. R = DCSCopyTextDefinition(None, q, (0, len(q))) ![]() Objc.pathForFramework('/System/Library/Frameworks/amework/Frameworks/amework')įor q in ]: Don't know whether this should work under later OSes. Since pyobjc bridgesupport file for amework is broken under OS X 10.6.8, fixed bridgesupport metadata is loaded manually here. I know this is so very late reply but anyway here's my version of pyobjc code which works under OS X 10.6.8. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |