Avoid typing username/password for every push.
See https://git-scm.com/docs/git-credential-store#_examples
$ git config credential.helper store
$ git push http://example.com/repo.git
Username:
https://en.wikipedia.org/wiki/Magic_SysRq_key |
# Prerequisites: | |
# - gdal2tiles.py (https://gdal.org/) | |
# - map.tit, a GeoTIFF file generated, for example, by QGIS | |
$ sudo apt install gdal-bin | |
$ gdal2tiles.py map.tif tiles | |
$ cd tiles && python -m http.server | |
# Go to http://localhost:8000/leaflet.html; | |
# place tiles/ on a web server and create a L.tileLayer using the tiles. |
// Extract is a nested document, which exists in some documents only. | |
// | |
// Collection data defines a partial index on extract.created_at. | |
// | |
// Finding documents which have extract set takes long, if the collection is large. | |
// | |
// Use hint() to search the index extarct.created_at in determining, if extract exists. | |
db.data.getIndices() | |
/* | |
{ |
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# From https://unix.stackexchange.com/a/18631/56290 | |
# Rotate even pages by 180 degrees, don't rotate odd pages. | |
pdftk A=infile.pdf shuffle Aoddnorth Aevensouth output outfile.pdf |
# Touch a file containing self-signed certificates to be used by git. | |
touch ~/.git-certs | |
chmod 600 ~/.git-certs | |
# Append the certificate to the file created aboe. | |
# https://stackoverflow.com/questions/7885785/using-openssl-to-get-the-certificate-from-a-server#comment26410932_7886248 | |
echo \ | |
| openssl s_client -connect my.server.com:443 2>&1 \ | |
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \ | |
>> ~/.git-certs |
# Match .msg against case-insensitive regex; | |
# output .name and .time of matching documents. | |
jq 'select(.msg|test("aggregating variable";"i")) | .name,.time' input.json | |
# Output single line, as CSV. | |
jq -c 'select(.msg|test("aggregating variable";"i")) | .name,.time' input.json | tr -d '[]' | |
# Output value, default to 0, if field is missing. | |
jq '.value // 0' input.json |
# https://stackoverflow.com/questions/49839028/how-to-upgrade-docker-compose-to-latest-version | |
sudo apt remove docker-compose | |
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r) | |
DESTINATION=/usr/local/bin/docker-compose | |
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION | |
sudo chmod +x $DESTINATION |
# Assuming there's a Docker container runninng Mongo, named `mongo1`, | |
# fire up another container `mongo2`, | |
# mounting a directory containing data to import, | |
# and execute `mongoimport` inside `mongo2`, | |
# to import data into `mongo1`. | |
# Start `mongo2`: | |
# link it to the running `mongo1`; | |
# open a bash session; | |
# mount pwd to /import; |
ls | rev | cut -d '.' -f 1 | rev | sort | uniq -c |
Avoid typing username/password for every push.
See https://git-scm.com/docs/git-credential-store#_examples
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: