Skip to content

Instantly share code, notes, and snippets.

View JCGoran's full-sized avatar

JCGoran

View GitHub Profile
@JCGoran
JCGoran / README.md
Last active November 29, 2023 08:52
Running tmux on CSCS Piz Daint

Since tmux is not available by default on Piz Daint, here's a short guide on how to install and use it there (as of 2020-01-16).

Load the necessary modules:

module load daint-gpu EasyBuild-custom/cscs

Now you can build tmux using:

eb tmux-2.9.eb -r
@JCGoran
JCGoran / notify-toggle.sh
Last active February 1, 2020 15:55
Enabling/disabling notifications on XFCE 4.14 with an indicator notification
#!/usr/bin/env sh
# the main command to send
comm="xfconf-query -c xfce4-notifyd -p /do-not-disturb"
# query for status
status="$(${comm})"
# if 'Do not disturb' is off, we send a notification, and then turn it on
if [ "${status}" = "false" ]
then
notify-send 'NOTICE' 'Notifications have been disabled!'
@JCGoran
JCGoran / README.md
Created May 4, 2020 17:09
Backing up edited Joplin resources

This is a small shell script which can be used to backup edited Joplin resources, since this is, as of time of writing, still an open issue. Should work on any GNU/Linux or MacOS machine since it just uses POSIX utils.

Note that you should manually set the env variables JOPLIN_CURRENT_DIR (where Joplin currently saves everything) and JOPLIN_BACKUP_DIR (where the backup directory is); usually the former is ${HOME}/.config/joplin-desktop (the default value), and the latter is determined by the user (default value is ${HOME}/.joplin-backup).

Usage:

sh editable-resources.sh
@JCGoran
JCGoran / cadmus.sh
Last active October 23, 2020 23:29
Script for building and running cadmus
#!/usr/bin/env bash
# a POSIX-compatible shell script that builds cadmus the easy way
# requirements:
# - git
# - python3 (with pip and venv)
# - make
# - cmake
# - a C++ compiler (g++ will do)
@JCGoran
JCGoran / LATEX_TO_GITLAB.md
Created February 11, 2021 19:59
Latex <--> Gitlab markdown converter

Simple Perl scripts which use regex search and replace to in-place convert Latex markdown files (which use $[MATH]$ and $$[MATH]$$) to Gitlab markdown (which uses $`[MATH]`$ and ```math [MATH]``` and vice versa.

One caveat: the $$[MATH]$$ style should have the math environment delimiters on separate newlines, so this works:

$$
[MATH]
$$
@JCGoran
JCGoran / README.md
Created March 2, 2022 10:54
Machine-readable list of arXiv categories

This is a (hopefully exhaustive) machine-readable list of all arXiv categories (archive + subject class, as per the docs). Data taken from the category taxonomy page.

@JCGoran
JCGoran / post-commit
Created March 28, 2022 11:03
LaTeX project post-commit hook that verifies that a project can be built before pushing it to a remote
#!/usr/bin/env sh
# simple script for checking that a LaTeX project builds after a commit
# USAGE: save this as `.git/hooks/post-commit` in your project, and make it executable using `chmod +x .git/hooks/post-commit`.
# The script will then run after each `git commit` to the repository.
# NOTE: to turn off the check, run `git commit --no-verify` instead.
# REQUIREMENTS: git, latexmk, notify-send (optional)
# notify-send settings
@JCGoran
JCGoran / bump_version.sh
Last active November 7, 2022 09:25
Script for bumping the version of a Python package using Poetry and a VERSION.txt file
#!/usr/bin/env sh
# script for bumping the version of a Python package (major, minor, or patch)
# to keep both poetry and the file containing the version number in sync
# requirements:
# - Python 3 with venv and Poetry
# - any POSIX-compatible shell
# - awk
@JCGoran
JCGoran / parse_exchange_rate.py
Last active September 4, 2023 16:49
Download ECB exchange rate XML and convert it into a Python dictionary
#!/usr/bin/env python3
"""
Method for obtaining the exchange rate from the ECB.
"""
from __future__ import annotations
import xml.etree.ElementTree as ET
@JCGoran
JCGoran / Dockerfile
Last active September 27, 2023 10:29
Building whisper.android using Docker
# Use an official Android SDK image as the base image.
FROM openjdk:17-bullseye
# Set environment variables for Android SDK
ENV ANDROID_HOME /opt/android-sdk
ENV PATH $PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools
# Needed for the `sdkmanager` package as it's not available in bullseye
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main contrib non-free' >> /etc/apt/sources.list