Skip to content

Instantly share code, notes, and snippets.

View literalplus's full-sized avatar
🍍

Philipp Nowak literalplus

🍍
View GitHub Profile
@literalplus
literalplus / pdfacompliance.tex
Last active January 21, 2024 02:25
PDF/A compliance for LaTeX files isn't as simple as they all say apparently. This copied-from-various-internet-sources hack file seems to fix it for me.
% ref: https://www.mathstat.dal.ca/~selinger/pdfa/
% inspired by: https://github.com/op3/latex-pdfa-howto/tree/master
% inspired by: https://gitlab.com/ThomasAUZINGER/vutinfth/-/merge_requests/3/diffs
% VALIDATION TOOL TO CHECK - https://verapdf.org/software/
% Adding graphics, fonts, etc. may break PDF/A, please re-check before submitting
% PACKAGE DEPENDENCIES
\usepackage{hyperxmp} % Write hyperref props to XMP instead of needing separate file / weird workarounds as with pdfx
\usepackage{colorprofiles} % Includes all the tasty colour profiles we define below wutg the weird PDF streams
@literalplus
literalplus / openpgp.md
Last active September 24, 2023 19:36
PGP key verification

openpgp4fpr:01E92FBCF4297D2BD5B5A76736CD0E9B2E6E2B8C

@literalplus
literalplus / actual-request.sh
Last active April 30, 2020 15:05
PHP 7.4.4 curl multiline headers
# copied from webhook.site using copy as curl
curl -X 'GET' 'https://webhook.site/d34983e4-f375-4bda-9c14-ae4d9738a113' -H 'connection: close' -H 'x-yolo: true' -H 'content-type: application/pdf' -H 'accept: */*' -H 'host: webhook.site' -H 'content-length: '
@literalplus
literalplus / ts-enum-from-string.ts
Last active October 15, 2019 21:05
Example of getting enum values by a string key in TypeScript
interface AxiosResponse {
data?: any;
}
enum ErrorKey {
ServerError = 1,
WeirdException,
UnknownError,
}
#!/bin/bash
if [[ $# -eq 0 ]]; then
echo "Usage:"
echo " intelctl max <max> - Sets max CPU percentage."
echo " intelctl min <min> - Sets min CPU percentage."
echo " intelctl both <min> <max> - Sets both limits."
echo " intelctl turbo <on|off> - Enables/Disables turbo."
echo " intelctl status - Shows status."
exit 0
@literalplus
literalplus / 0_Grafana_Annotations_Bash.md
Last active July 4, 2019 14:26
Collection of Bash scripts to simplify publishing annotations to Grafana.

Grafana Annotations via Bash scripts

Ever wanted to annotate Grafana panels with when your backups are executed or whatever? Have some possibly useful scripts. These create region annotations, so you're supposed to call the script again with the update operation to set the end time. If you don't, they will be zero-length, which does look a little weird in the interface. Alternatively, you can just change isRegion to false. Note that it really does need the full annotation JSON to update because Grafana replaces the document entirely. If we were to only send the new end time, all other info (description, etc.) would be deleted.

Also, you need to have jq installed for this to work.

@literalplus
literalplus / 0_acme-test.sh
Last active April 2, 2018 17:19
Bash script to bulk-check if ACME HTTP webroot responses are working. Requires a file with the content "HENLO" to be present at /.well-known/acme-challenge/test.txt
#!/bin/bash
# Checks whether given domain has a file at .well-known/acme-challenge/test.txt
# with content "HENLO", for HTTP and HTTPS.
# Pass -q to hide the curl progress bar.
QUIET=""
RED="\e[31m"
GREEN="\e[92m"
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
@literalplus
literalplus / 0_LaTeX_Multiple_Choice.md
Last active April 17, 2018 13:20
Multiple Choice in LaTeX

LaTeX Multiple Choice

Here's a thing I made to make creating multiple choice quizzes and answers easier in LaTeX.

@literalplus
literalplus / start-artifactory.sh
Last active April 2, 2018 17:29
Start Artifactory in a Docker container and configure it to run without context path (i.e. from / instead of /artifactory )
#!/bin/bash
docker pull docker.bintray.io/jfrog/artifactory-oss:latest
echo "Running docker container yay"
CONTAINER_ID=$(docker run --name artifactory -d -p 8081:8081 \
-v /var/www/artifactory:/var/opt/jfrog/artifactory \
--restart unless-stopped \
docker.bintray.io/jfrog/artifactory-oss:latest)
RUN_RES="$?"
if [ "$RUN_RES" -ne 0 ]; then
echo "Unable to start container, sorry."
@literalplus
literalplus / 0_tomcat.conf
Last active January 15, 2018 00:25
A Jenkins,Artifactory/Nginx reverse proxy setup (is work, no touchy)
# /etc/nginx/sites-available/tomcat.conf
server {
include snippets/listen_both_le.conf;
include snippets/cert_l1t.conf;
server_name ci.l1t.li;
location / {
include snippets/proxy-header.conf;