Skip to content

Instantly share code, notes, and snippets.

View jion's full-sized avatar

Manuel Schnidrig jion

View GitHub Profile
@jion
jion / celery.sh
Created April 24, 2019 23:44 — forked from amatellanes/celery.sh
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@jion
jion / keybase.md
Created March 31, 2020 14:45
Proof of Github Account

Keybase proof

I hereby claim:

  • I am jion on github.
  • I am jion (https://keybase.io/jion) on keybase.
  • I have a public key ASAAnImfrjIzNzVkkvWL0MGhHNPDwifv-jLhvHuGakExIwo

To claim this, I am signing this object:

from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from . import models
from . import utils
def send_messages(request, merchant_id):
merchant = get_object_or_404(models.Merchant, id=merchant_id)
customers = models.Customer.objects.filter(merchant=merchant)
@jion
jion / csv_columns_subset.py
Last active April 2, 2022 23:58
Helper to filter CSV columns you need
#!/usr/bin/python3
import csv
import sys
csv_reader = csv.DictReader(sys.stdin)
csv_writer = csv.DictWriter(sys.stdout, fieldnames=[h for h in csv_reader.fieldnames if h in sys.argv[1:]])
csv_writer.writeheader()
for row in csv_reader:
csv_writer.writerow({f: row[f] for f in sys.argv[1:]})
@jion
jion / README.md
Last active July 12, 2023 15:50
Sensitive configuration for relativenumbers mode

Toggleable Relative Numbering for Vim

This Vim configuration snippet introduces a feature that allows users to easily toggle between "relative" and "absolute" line number modes in Vim.

In "relative" line number mode, the lines are numbered relative to the cursor's current position, which can be helpful when making movements or operations that are relative to the current line. In "absolute" line number mode, Vim displays the actual line numbers, just like most other text editors.

The user can toggle between these two modes by pressing a combination of keys (<leader>`). The script remembers the user's preference and applies it to whichever window (a.k.a buffer) the cursor is currently in. This means that if a user prefers relative numbering, as they navigate between different windows, each will switch to relative numbering as they come into focus.

In addition, there are specific rules in place for certain buffer types, like terminal buffers, to disable line numbering altogether.