<cmd> / <ctrl> are equivalent
| shortcut | action |
|---|
| var resultList = document.querySelector('#s-results-list-atf'); | |
| var results = resultList.getElementsByTagName('li'); | |
| for (var i=0; i<results; i++) { | |
| console.log(results[i].getAttribute('data-asin'); | |
| } |
| def notify(title, subtitle, notification, soundname='Hero'): | |
| ''' use applescript to display a notification on macOS | |
| ''' | |
| osascript_params = { | |
| 'title': title, | |
| 'subtitle': subtitle, | |
| 'soundname': soundname, | |
| 'notification': notification | |
| } | |
| osascript_cmd = '\'display notification \"{notification}\" with title \"{title}\" subtitle \"{subtitle}\" sound name \"{soundname}\"\''.format(**osascript_params) |
| def progressbar(seconds, prefix='', suffix=''): | |
| ''' render a progressbar on the commandline | |
| ''' | |
| def print_progressbar(iteration, total, decimals=1, length=100, fill= '█'): | |
| """ | |
| Call in a loop to create terminal progress bar | |
| @params: | |
| iteration - Required : current iteration (Int) | |
| total - Required : total iterations (Int) |
| def countdown(timeout): | |
| ''' render a countdown on the commandline | |
| ''' @param timeout: minutes to count down | |
| while timeout: | |
| mins, secs = divmod(timeout, 60) | |
| cntdwn = '{:02d}:{:02d}'.format(mins, secs) | |
| print(cntdwn, end='\r') | |
| sleep(1) | |
| timeout -= 1 |
| def gen_tree(self, category_strs): | |
| ''' takes an array of category strings eg: | |
| ["Heim & Garten > Rasen & Garten > Bewässerungssysteme", | |
| "Heim & Garten > Rasen & Garten > Gartenbau"] | |
| and returns an category tree dict eg: | |
| { | |
| "root": { | |
| "children:": { | |
| "Heim & Garten": { | |
| "slug": { |
| -- find duplicated values | |
| SELECT | |
| address_line1, address_line2, zip, city, country, COUNT(*) | |
| FROM | |
| location | |
| GROUP BY | |
| address_line1, address_line2, zip, city, country | |
| HAVING | |
| COUNT(*) > 1; |
| .PHONY: list | |
| list: | |
| @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs | tr ' ' '\n' |