GitHub projects
Just to inform (in case when Google stop working one day 😃) that my public projects are stored on GitHub https://github.com/jaroslawhartman
IT, Telco & hobbies
Just to inform (in case when Google stop working one day 😃) that my public projects are stored on GitHub https://github.com/jaroslawhartman
When you add some timezones to your Apple Calendar, it’s somehow difficult to remove them and you end up with a list which you perhaps don’t need anymore:
How to remove them? Rather easy, but we need a plist editor (easiest way to get it is to install XCode). Once we have it, just type in your terminal
1 |
$ open ~/Library/Preferences/com.apple.iCal.plist |
Find attribute RecentlyUsedTimeZones, unfold it and delete unwanted items:
A MacOS Alfred workflow to open a predefined Webex session.
Pre-requisites:
It’s pretty basic, but helps me to speed up a very common activity (which I always tend to do on very last second when a my conference call is about to start)…
So when I urgently need to open Webex conference, instead of searching through my browser bookmarks, just press Option-Space and type webex:
Then press Enter to get the list of your web conferences, for example:
Hit cursor down or up to select bridge you want to open and just press enter.
After downloading the workflow, just doubleclick the file and it will get imported to your Alfred.
Ok, how you could add your most frequently used Webex URLs to the list? Navigate to Alfred workflows, find Webex workflow and select Open in Finder:
Then open configuration.txt
in your text editor:
In the file, set your URLs in format <Name>|<URL>
, for example Jarek|https://webex.com/joint/jarek.hartman
:
Save and done!
I’m glad to mention that Alfred Timezone workflow has been mentioned as a “Favourite” on Alfred’s workflows page https://www.alfredapp.com/workflows/ . Many thanks for this!
The workflow can be downloaded from downloads section.
Due to issues with my current hosting, I decided to move the site to a new server. This might be a temporary location but will decide after a few days.
A script to pull Kindle Vocabulary Builder DB and convert into Memrise course.
The latest Kindle Paperwhite (second generation) offers the Vocabulary Builder feature. With Vocabulary Builder, you can look up words with the dictionary and memorize their definitions.
For my self-education I use http://memrise.com/ (both on my phone and desktop PC). I thought it would be great to pull words which I’ve checkded when reading English books on my Kindle and push them into my Memrise course.
memrise.db
(the mp3 is written to the disk only, folder audio
)vocab.db
file (retrieved from your Kindle, from /Volumes/Kindle/system/vocabulary/
)I heavily sourced from two GitHub projects:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
MBP:kindle-to-memrise jhartman$ ./kindle2memrise.py -h usage: kindle2memrise.py [-h] [-kindleDB KINDLEDB] [-dictionaryDB DICTIONARYDB] [-output OUTPUT] [-revision REVISION] [-debug] optional arguments: -h, --help show this help message and exit -kindleDB KINDLEDB Kindle vocabulary db filename (default: vocab.db) -dictionaryDB DICTIONARYDB Memrise dictionary db filename (default: memrise.db) -output OUTPUT Output file to import to memrise.com (default: memrise.txt) -revision REVISION Revision to output. Not specfied (default): last, 0 - all -debug Enable debug |
At minimum, the tool does not require any parameters, it will search for vocab.db
in the current folder and will write output files into the same, current folder.
Pay your special attention to memrise.txt
which has been generated:
1 2 3 4 5 |
MBP:kindle-to-memrise jhartman$ tail memrise.txt mere Sam. Used to emphasize that something is not large or important. Example: It costs a mere twenty dollars. mɪər thinning Rozcieńczać, rozrzedzać. To make a substance less thick, often by adding a liquid to it. Example: N/A θɪn carnivore Zwierzę mięsożerne. An animal that eats meat. Example: N/A ˈkɑːnɪvɔːr embrace Obejmować (się). If you embrace someone, you put your arms around them, and if two people embrace, they put their arms around each other.. Example: We are always eager to embrace the latest technology. ɪmˈbreɪs |
This is the file, which will be used for bulk word add into your Course.
Go to your Course, press Edit and in the Advanced options, look for Bulk add words:
Open memrise.txt
in an editor (e.g. Notepad), select all, copy it and paste into Memrise Bulk Add form then press Add:
That’s it!
Download the script from GitHub: https://github.com/jaroslawhartman/kindle-to-memrise
First attempt to the installation failed because of missing graphviz:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
(django_python_env) MBP:mysite jhartman$ pip3 install pygraphviz Collecting pygraphviz Downloading pygraphviz-1.3.1.zip (123kB) 100% |████████████████████████████████| 133kB 1.4MB/s Building wheels for collected packages: pygraphviz Running setup.py bdist_wheel for pygraphviz ... error Complete output from command /Users/jhartman/scripts/django_python_env/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/t7/v05f2p5j5kgdd8t_px1lv1jc0000gn/T/pip-build-zn5secqs/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/t7/v05f2p5j5kgdd8t_px1lv1jc0000gn/T/tmp34txy01_pip-wheel- --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.12-x86_64-3.6 creating build/lib.macosx-10.12-x86_64-3.6/pygraphviz copying pygraphviz/__init__.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz copying pygraphviz/agraph.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz copying pygraphviz/graphviz.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz copying pygraphviz/release.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz copying pygraphviz/version.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz creating build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz/tests running egg_info writing pygraphviz.egg-info/PKG-INFO writing dependency_links to pygraphviz.egg-info/dependency_links.txt writing top-level names to pygraphviz.egg-info/top_level.txt reading manifest file 'pygraphviz.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*~' found anywhere in distribution warning: no previously-included files matching '*.pyc' found anywhere in distribution warning: no previously-included files matching '.svn' found anywhere in distribution no previously-included directories found matching 'doc/build' writing manifest file 'pygraphviz.egg-info/SOURCES.txt' copying pygraphviz/graphviz.i -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.12-x86_64-3.6/pygraphviz running build_ext building 'pygraphviz._graphviz' extension creating build/temp.macosx-10.12-x86_64-3.6 creating build/temp.macosx-10.12-x86_64-3.6/pygraphviz clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.12-x86_64-3.6/pygraphviz/graphviz_wrap.o pygraphviz/graphviz_wrap.c:2954:10: fatal error: 'graphviz/cgraph.h' file not found #include "graphviz/cgraph.h" ^ 1 error generated. error: command 'clang' failed with exit status 1 |
Ok, so next obvious step was to install missing library using brew:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
MBP:~ jhartman$ brew install libcgraph Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae ammonite-repl apache-flink checkstyle libass pcap_dnsproxy supervisor zanata-client angular-cli bastet confuse neo4j s6 swiftformat Error: No available formula with the name "libcgraph" ==> Searching for a previously deleted formula... Error: No previously deleted formula found. ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... Error: No formulae found in taps. MBP:~ jhartman$ brew install graphviz ==> Installing dependencies for graphviz: libtool, libpng, freetype, fontconfig, jpeg, libtiff, webp, gd ==> Installing graphviz dependency: libtool ==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_1.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring libtool-2.4.6_1.sierra.bottle.tar.gz ==> Using the sandbox ==> Caveats In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: glibtool and glibtoolize. ==> Summary /usr/local/Cellar/libtool/2.4.6_1: 70 files, 3.7MB ==> Installing graphviz dependency: libpng ==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.29.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring libpng-1.6.29.sierra.bottle.tar.gz /usr/local/Cellar/libpng/1.6.29: 26 files, 1.2MB ==> Installing graphviz dependency: freetype ==> Downloading https://homebrew.bintray.com/bottles/freetype-2.8.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring freetype-2.8.sierra.bottle.tar.gz /usr/local/Cellar/freetype/2.8: 63 files, 2.6MB ==> Installing graphviz dependency: fontconfig ==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.12.1_2.sierra.bottle.1.tar.gz ######################################################################## 100.0% ==> Pouring fontconfig-2.12.1_2.sierra.bottle.1.tar.gz ==> Regenerating font cache, this may take a while ==> /usr/local/Cellar/fontconfig/2.12.1_2/bin/fc-cache -frv /usr/local/Cellar/fontconfig/2.12.1_2: 487 files, 3.1MB ==> Installing graphviz dependency: jpeg ==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.sierra.bottle.2.tar.gz ######################################################################## 100.0% ==> Pouring jpeg-8d.sierra.bottle.2.tar.gz /usr/local/Cellar/jpeg/8d: 19 files, 708.3KB ==> Installing graphviz dependency: libtiff ==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.8.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring libtiff-4.0.8.sierra.bottle.tar.gz /usr/local/Cellar/libtiff/4.0.8: 245 files, 3.4MB ==> Installing graphviz dependency: webp ==> Downloading https://homebrew.bintray.com/bottles/webp-0.6.0.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring webp-0.6.0.sierra.bottle.tar.gz /usr/local/Cellar/webp/0.6.0: 36 files, 2.0MB ==> Installing graphviz dependency: gd ==> Downloading https://homebrew.bintray.com/bottles/gd-2.2.4_1.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring gd-2.2.4_1.sierra.bottle.tar.gz /usr/local/Cellar/gd/2.2.4_1: 34 files, 1MB ==> Installing graphviz ==> Downloading https://homebrew.bintray.com/bottles/graphviz-2.40.1.sierra.bottle.1.tar.gz ######################################################################## 100.0% ==> Pouring graphviz-2.40.1.sierra.bottle.1.tar.gz /usr/local/Cellar/graphviz/2.40.1: 536 files, 12.9MB |
Everything looked find, however pip’ing still shown same problem with not installed library. I think the reason was in the warning show above:
1 2 |
In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: glibtool and glibtoolize. |
Ok, so where we have eventually the lib?
1 2 3 4 5 6 7 8 |
MBP:~ jhartman$ find /usr/local/Cellar/ -name "*graphviz*" /usr/local/Cellar//graphviz /usr/local/Cellar//graphviz/2.40.1/.brew/graphviz.rb /usr/local/Cellar//graphviz/2.40.1/include/graphviz /usr/local/Cellar//graphviz/2.40.1/include/graphviz/graphviz_version.h /usr/local/Cellar//graphviz/2.40.1/lib/graphviz /usr/local/Cellar//graphviz/2.40.1/share/graphviz /usr/local/Cellar//graphviz/2.40.1/share/man/man7/graphviz.7 |
So we’re almost there. Let’s convince pip to use include and lib folder mentioned above (by enforcing it by --install-option
):
1 2 3 4 5 6 7 8 9 |
(django_python_env) MBP:mysite jhartman$ pip3 install pygraphviz --install-option="--include-path=/usr/local/Cellar/graphviz/2.40.1/include/" --install-option="--library-path=/usr/local/Cellar/graphviz/2.40.1/lib/" /Users/jhartman/scripts/django_python_env/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options. cmdoptions.check_install_build_global(options) Collecting pygraphviz Using cached pygraphviz-1.3.1.zip Skipping bdist_wheel for pygraphviz, due to binaries being disabled for it. Installing collected packages: pygraphviz Running setup.py install for pygraphviz ... done Successfully installed pygraphviz-1.3.1 |
We’re done!
Minor updates to the workflow:
v1.9, 4th of May 2017
Workflow can be downloaded from here: Alfred-TimeZones
It has been reported that the script does not work anymore:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
jhartman@wieloryb:~/scripts/withings-garmin-v2$ ./sync.py Traceback (most recent call last): File "./sync.py", line 124, in <module> main() File "./sync.py", line 59, in main sync(**opts.__dict__) File "./sync.py", line 116, in sync cookie = garmin.login(garmin_username, garmin_password) File "/home/jhartman/scripts/withings-garmin-v2/garmin.py", line 132, in login cookies = self._get_cookies(email=username, password=password) File "/home/jhartman/scripts/withings-garmin-v2/garmin.py", line 100, in _get_cookies data["lt"] = re.search("name=\"lt\"\s+value=\"([^\"]+)\"", preResp.text).groups(1)[0] AttributeError: 'NoneType' object has no attribute 'groups' |
I’ve managed to fix it. See latest commit in https://github.com/jaroslawhartman/withings-garmin-v2
After one of JVM updates, my Belkin KVM (Remote IP Manager) has started refusing to start with “Falied to validate certificate” error followed by “PKIX path validation failed”:
I’ve found following exceptions in Java console:
1 2 3 4 |
sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled signature algorithm: MD5withRSA at sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:352) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:249) ... |
and
1 2 3 4 5 6 7 |
com.sun.deploy.security.BlockedException: User has denied the privileges to the code at sun.plugin2.applet.Plugin2ClassLoader.getPermissions(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.getPermissions(Unknown Source) at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:206) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ... |
Google says that this is pretty common problem and returned plenty of receipts how to fix it.
Scanning the system for potential locations of the java.security file, there are four candidates. However, there is a catch: we should fix Java not in the system-wide location but the Java plugin for the web browser you’re using (Safari on MacOS in my case).
1 2 3 4 5 |
Jareks-MacBook-Pro:~ jhartman$ locate java.security /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.security /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/java.security /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/security/java.security /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/security/java.security |
So we can skip the last three locations and just focus on the 1st one. Change the lines as described
1 2 3 4 5 6 |
Jareks-MacBook-Pro:~ jhartman$ edit "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.security" jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 256, \ DSA keySize < 1024, EC keySize < 224 jdk.tls.disabledAlgorithms=SSLv3, RC4, DH keySize < 768, \ EC keySize < 224 |
Save and restart the browser (Safari). This time the KVM applet can start (after plenty of security warnings though).
The application has to be also white-listed, otherwise it will generate error as below:
Open System Preferences, Java settings and add IP address of your KVM to the list:
Add following:
Again: save and restart your browser.
Another security exception is required (after one of Java 8 updates):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
RFB: trying JSSE15-SSL connection to 192.168.1.111:444 RFB: JSSE15-SSL connect: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.deploy.security") RFB: JSSE15-SSL connection FAILED to 192.168.1.111:444 RFB: trying connection to 192.168.1.111:444 network: Cache entry not found [url: http://192.168.1.111:444/crossdomain.xml, version: null] network: Connecting http://192.168.1.111:444/crossdomain.xml with proxy=DIRECT network: Connecting http://192.168.1.111:444/ with proxy=DIRECT network: Connecting http://192.168.1.111:444/crossdomain.xml with cookie "pp_session_id=74CE00A4735D02A0EE36BFA24EC6335837A2B97F0D6BF02E1D081BB6DA783C13" network: Connecting http://192.168.1.111:444/ with proxy=DIRECT java.net.SocketException: Unexpected end of file from server at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:848) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587) at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:91) at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1484) at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1482) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1481) at com.sun.deploy.net.CrossDomainXML.check(Unknown Source) at com.sun.deploy.net.CrossDomainXML.check(Unknown Source) at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source) at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source) at java.net.Socket.connect(Socket.java:584) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at nn.pp.rc.aw.if(Unknown Source) at nn.pp.rc.aw.g(Unknown Source) at nn.pp.rc.ac.case(Unknown Source) at nn.pp.rc.aj.run(Unknown Source) |
Edit this config file:
1 |
MBP:~ jhartman$ edit "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.policy" |
Add this line within the grant { }; section:
1 2 |
// KVM permission java.net.SocketPermission "192.168.1.111:444", "connect, accept"; |