A simple Ghostscript command to merge two PDFs in a single file is shown below:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf
Install Ghostscript:
Type the command sudo apt-get install ghostscript
to download and install the ghostscript package and all of the packages it depends on.
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
#!/bin/bash | |
# store the current dir | |
CUR_DIR=$(pwd) | |
# Let the person running the script know what's going on. | |
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n" | |
# Find all git repositories and update it to the master latest revision | |
for i in $(find . -name ".git" | cut -c 3-); do |
#!/bin/bash | |
################################## | |
# | |
# THE ARCHIVE TRACKER | |
# | |
# REF: https://gist.github.com/markwk/c85a8a72bc8c03d0f510262bb5219a34/ | |
# | |
# INTRODUCTION: | |
# Daily script to navigate to a directory of plain text files, | |
# add files to git repo, calculate key stats, store stats to csv |
Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺
Locally, I'm at this commit:
$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date: Sun Apr 15 16:35:03 2012 +0200
When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.
This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.
A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:
- It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
- It is free, with no quotas.
- Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
import torch | |
def jacobian(y, x, create_graph=False): | |
jac = [] | |
flat_y = y.reshape(-1) | |
grad_y = torch.zeros_like(flat_y) | |
for i in range(len(flat_y)): | |
grad_y[i] = 1. | |
grad_x, = torch.autograd.grad(flat_y, x, grad_y, retain_graph=True, create_graph=create_graph) | |
jac.append(grad_x.reshape(x.shape)) |
This should work generally, but I use this to track the number of words changed in a (LaTeX) paper with a version history in git (and which Overleaf uses by default).
This is a tricky thing to deal with for many reasons.
Show the added words, deleted words, words on duplicate lines on every commit in the last day (bash):
# These instructions assume you are using a Linux or Mac machine as | |
# the “local” machine and an Amazon Linux as the “remote” machine. | |
# Here’s one way to get X11 working between the two. | |
# on the local machine (Linux or Mac with X11 already installed) | |
$ ssh -X -i <amazon_key.pem> ec2-user@<remote_ec2_box_name> | |
# then on the remote Amazon Linux EC2 box | |
$ sudo yum install xauth | |
$ sudo yum install xterm |