- 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 |
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, |
#!/bin/sh | |
# In case df shows >90% for /boot run: | |
#sudo apt-get autoremove | |
# Add repository | |
sudo add-apt-repository ppa:ondrej/php | |
# Install required packages | |
sudo apt-get update |
A warning occurred (42 apples) | |
An error occurred |
<?php | |
/** | |
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you | |
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile | |
* type). You can use php://temp to get around this for one file, but if you want to upload | |
* multiple files then you've got a bit more work. | |
* | |
* This function manually constructs the multipart request body from strings and injects it | |
* into the supplied curl handle, with no need to touch the file system. |