- Install pre-requisities
sudo apt-get install build-essential tcl
- Install Redis
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
| function getHightlightCoords() { | |
| var pageIndex = PDFViewerApplication.pdfViewer.currentPageNumber - 1; | |
| var page = PDFViewerApplication.pdfViewer.getPageView(pageIndex); | |
| var pageRect = page.canvas.getClientRects()[0]; | |
| var selectionRects = window.getSelection().getRangeAt(0).getClientRects(); | |
| var viewport = page.viewport; | |
| var selected = selectionRects.map(function (r) { | |
| return viewport.convertToPdfPoint(r.left - pageRect.x, r.top - pageRect.y).concat( | |
| viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y)); | |
| }); |
| override func viewDidLoad() { | |
| createMenu() | |
| } | |
| private func createMenu() { | |
| let highlightItem = UIMenuItem(title: "Highlight", action: #selector(highlight(_:))) | |
| UIMenuController.shared.menuItems = [highlightItem] | |
| } | |
| @objc private func highlight(_ sender: UIMenuController?) { |
sudo apt-get install build-essential tcl
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
Based on https://techwombat.com/enable-http2-apache-ubuntu-16-04/
This totorial is for an older Ubuntu 16.04, for a Ubuntu 18.04 please read here --> https://gist.github.com/GAS85/8dadbcb3c9a7ecbcb6705530c1252831
| #!/bin/bash | |
| # This is a very naive script, it doesn't do grouping and returns all branches | |
| # I only really care about branches that have not seen commits in two months | |
| # | |
| # I am hoping to find some time to write a tool that can output these reports for me | |
| # In the meantime, I am using this | |
| echo "Merged branches" | |
| for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r |
| # You need to put this under <app>/management/commands/run.py | |
| # where <app> is whatever appropriate app should have this command. | |
| # Then you can invoke it with ./manage.py run and you'll get something like: | |
| # Performing system checks... | |
| # SKIPPING SYSTEM CHECKS! | |
| # SKIPPING MIGRATION CHECKS! |
| [ | |
| { | |
| "name": "Apple", | |
| "value": "214480", | |
| "year": 2018, | |
| "lastValue": "211447.400000003", | |
| "rank": 1 | |
| }, | |
| { | |
| "name": "Apple", |
| import datetime | |
| import json | |
| from bson import ObjectId | |
| from mongoengine.base import BaseDocument | |
| from mongoengine.queryset import QuerySet | |
| class MongoengineEncoder(json.JSONEncoder): | |
| def default(self, obj): |
| git rebase --interactive HEAD~2 | |
| # we are going to squash c into b | |
| pick b76d157 b | |
| pick a931ac7 c | |
| # squash c into b | |
| pick b76d157 b | |
| s a931ac7 c |
| import json | |
| from collections import Iterable | |
| from bson import ObjectId | |
| from datetime import datetime | |
| class MongoengineEncoder(json.JSONEncoder): | |
| """ | |
| The default JSON encoder that ships with Mongoengine (the to_json method | |
| exposed on Document instances) makes some odd choices. Datetime objects | |
| are nested on a $date property, ObjectIds are nested on an $oid property, |