Skip to content

Instantly share code, notes, and snippets.

View jirikuncar's full-sized avatar
💭
👨‍💻

Jiri Kuncar jirikuncar

💭
👨‍💻
View GitHub Profile
@jirikuncar
jirikuncar / .gitattributes
Last active October 10, 2022 09:12
Git merge driver for `poetry.lock`
# or $GIT_DIR/info/attributes or $XDG_CONFIG_HOME/git/attributes or $HOME/.config/git/attributes
poetry.lock merge=poetry-lock
@jirikuncar
jirikuncar / style.css
Created October 31, 2019 15:41
Number headers with CSS
body {
counter-reset: h2counter;
}
h1 {
counter-reset: h2counter;
}
main h2:before {
content: counter(h2counter) ".\0000a0\0000a0";
@jirikuncar
jirikuncar / .bash_profile
Last active June 3, 2022 10:19
.dotfiles
#!/usr/bin/env bash
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Path to the bash it configuration
export BASH_IT="${HOME}/.bash_it"
@jirikuncar
jirikuncar / Dockerfile
Last active March 26, 2019 14:26
Traefik with ForwardAuth middleware
FROM python:3.7-alpine
RUN pip install flask
COPY app.py /code/app.py
WORKDIR /code
ENV FLASK_APP=app:app
CMD ["flask", "run", "-h", "0.0.0.0"]
import collections
import datetime
import logging
from goblin import properties
logger = logging.getLogger(__name__)
CARD_MAPPING = {'Cardinality.single': 'Cardinality.SINGLE',
@jirikuncar
jirikuncar / README.md
Last active September 3, 2024 09:40
Traefik - header matching

Traefik routing

Proxy to services based on Accept header.

Run

docker-compose up -d

Test

@jirikuncar
jirikuncar / .a README.md
Last active August 23, 2023 11:57
Remote Jupyter Kernel at CSCS

Configuration

Direct Access to Computing Systems

  1. Get an Account and store your account name export CSCS_USER=unixname.
  2. Configure direct access to the computing system. You can use the ssh_config template:
    $ cat >> ~/.ssh/config <<EOF
    Host *
    

AddKeysToAgent yes # only for MacOS

@jirikuncar
jirikuncar / README.rst
Last active September 28, 2016 21:43
PyLint checker for number of calls inside try blocks.

Download try_calls.py and install pylint

$ pip install pylint

Run pylint with an additional plugin on a bad.py file

$ pylint --load-plugins=try_calls bad.py

In case you try_calls.py is not recognized add it to PYTHONPATH.

@jirikuncar
jirikuncar / github-number-of-commits-since-last-tag.py
Created August 22, 2016 07:54
GitHub: number of commits since last tag
import sys
from getpass import getpass
import github3
def main(_, username, name='inveniosoftware'):
gh = github3.login(username, password=getpass())
org = gh.organization(name)
for repo in org.repositories():
tags = list(repo.tags(1))
# Add your Python code here. E.g.
import math
import random
from microbit import *
enemies = [[1, 0, 0.05]]
shots = []
game = True
killed = 0