JSON.parse("[" + str.trim().replace(/==>/g,"").replace(/\n/,",").replace(/([a-zA-Z0-9]+)=/g, '"$1": ').replace(/\[([a-zA-Z0-9_.//]+)\]/g, '["$1"]').replace(/\["(\d+)"\]/g, "[$1]").trim() + "]")
Pavallo's Tech Pit
Thursday, 7 November 2019
Parsing Gremlin console output into JSON (with node)
JSON.parse("[" + str.trim().replace(/==>/g,"").replace(/\n/,",").replace(/([a-zA-Z0-9]+)=/g, '"$1": ').replace(/\[([a-zA-Z0-9_.//]+)\]/g, '["$1"]').replace(/\["(\d+)"\]/g, "[$1]").trim() + "]")
Wednesday, 7 February 2018
Selenium Webdriver 2 fussing about Firefox version
Starting from version 3, Selenium is using Marionette - the new Firefox driver.
This note is about version 2.
Selenium has its own support pattern: http://www.seleniumhq.org/about/platforms.jsp
Firefox
Support for Firefox is the latest release, the previous release, the latest ESR release and the previous ESR release.For example Selenium 2.40.0 (released on Feb 19, 2014) supports Firefox 27, 26, 24, 17Selenium with Firefox can be run on any platform that Firefox supports for those versions, that also allow users to install a custom Firefox extension.
Find here version release histories:
Here, firefox downloads https://ftp.mozilla.org/pub/firefox/releases/
Installing Firefox v. 44.0 fixed troubles I had with:
MacOS 10.12.6
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
gem:
cucumber (2.3.2)
selenium-webdriver (2.52.0)
MacOS 10.12.6
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
gem:
cucumber (2.3.2)
selenium-webdriver (2.52.0)
Friday, 3 November 2017
playing music on hold when launching a bash command
This works using MacOS afplay
Usage:
$ long-running-command [args] | moh_player
If you want to retain colours, run it through script:
$ script -q /dev/null long-running-command [args] | moh_player
!/bin/bash
moh_file=~/Downloads/moh.mp3
afplay $moh_file &
pid=$!
trap "kill $pid" 2
while read line; do echo -e $line; done
kill $pid
Usage:
$ long-running-command [args] | moh_player
If you want to retain colours, run it through script:
$ script -q /dev/null long-running-command [args] | moh_player
Monday, 14 August 2017
Jest: mocking externally dependencies, classes and injecting the class contructor
It started posting a question on Stackoverflow here
Saturday, 12 August 2017
Custom Error in NodeJS v7
Had a lot of trouble with it but finally found this solution on Node v7.10.0 :
Monday, 15 May 2017
Maps of London with zones, tube, santander bikes, universities, Aldi, Sainsbury, Poundland, Home Bargain, Coop
Are you moving into London?
Do you want to know what's up in your neighbourhood?
I am having this problem nowadays, that's why I created a Google My Map with these layers:
- TFL zones
- Underground lines
- Santander bikes (might be disactivated)
- Universities
- Stores location: Aldi, Sainsbury, Poundland, Home Bargain, Coop
Here is the link to the map: https://drive.google.com/open?id=1PVkweUYubQeimWL-Mqq5GTs_NKE&usp=sharing
Friday, 28 April 2017
Android tablet as second monitor on Ubuntu 16.04
Do you want to connect your tablet or mobile phone to your Linux desktop as a second monitor?
So I decided to create a script that configures your X11 server and creates a VNC server automatically.
Yes, is working!
I am using Ubuntu 16.04 and an Android tablet.
It should work for both iOS and Android or any other device capable of running a VNC client.
It can do both landscape and portrait mode.
For androidians, it can also connect to your device through USB!
Let me know how it goes...
Subscribe to:
Posts (Atom)