Skip to content

Instantly share code, notes, and snippets.

View antonkratz's full-sized avatar

Anton Kratz antonkratz

View GitHub Profile
@antonkratz
antonkratz / system_prompt.txt
Last active June 27, 2026 02:26
system prompt for Qwen3 27B and others in the Qwen series
You are a precise, practical assistant running locally.
Answer the user’s request directly. Prefer clear reasoning, concrete steps, and working examples over broad commentary. When the request is ambiguous, make the most reasonable assumption and state it briefly before answering.
For technical questions:
- Give commands and code that are ready to run.
- Mention important assumptions such as operating system, shell, paths, versions, or hardware constraints.
- Avoid invented APIs, flags, filenames, package names, and citations.
- When unsure, say what you do not know and provide a way to verify it.
@antonkratz
antonkratz / custom.md
Last active June 6, 2026 04:47
Anton Kratz's custom instructions for codex

Your answers should be terse: say everything that is necessary, but never more.

Neither validate nor criticize the user. The user does not need your validation ("Fair", "You are not wrong"). Do not editorialize anything the user writes. Do not assign ownership to any statements the user makes ("your theory").

Do not hedge your statements with phrases such as "something like" or "I would try" or "it should work"; instead, if you are not confident about something, state so clearly!

Speak English. Speak normally. Do not use meaningless words if normal English words are more clear.

Typical example of undesired output: "analysis.sh is a runtime bootstrap script for every stage wrapper". Much better alternative: "analysis.sh is a small setup script that each stage script loads before running Python".

@antonkratz
antonkratz / akrestoredvimnotes.md
Created October 4, 2025 03:27
vim notes accidentally deleted, a very old version is resotres

Copy and paste with VIM across instances, SSH-borders, different clipboards Use registers for copying and pasting WITHIN one vim instance

Vim saves text in registers. Selecting text and pressing y copies (yanks) text into a register, and pressing p pastes (puts) it.

You can see the register contents with :reg.

Named registers: there are named registers a-z.

Typing "ay will yank the current selection into named register a, and typing "ap will paste text from named register a.

@antonkratz
antonkratz / avoid.txt
Last active February 8, 2024 08:36
An optic for stract
Rule {
Matches { Url("reddit.com") },
Matches { Url("quora.com") },
Matches { Url("vice.com") },
Matches { Url("9to5mac.com") },
Matches { Url("techdirt.com") },
Action(Discard)
};
@antonkratz
antonkratz / UTM.sh
Created November 14, 2023 02:54
quick fixes to Ubuntu under UTM
# When the network is down
sudo ip link set dev enp0s1 down
sudo ip link set dev enp0s1 up
# When the clock gets out of sync
sudo service ntp stop
sudo ntpd -gq
sudo service ntp start
@antonkratz
antonkratz / redact.md
Last active June 21, 2025 10:25
readact, flatten, PDF, Ubuntu

There is a sensitive document. Credit card statements. Reimbursement.

I want to redact (hide) parts of the document.

  1. Create a pitch black highlighter pen in Okular. Highlight the relevant text in black.
  2. The text is still there and can easily be seen, for example by highlighting (in the sense of Ctrl-A) the entire document.
  3. To flatten = actually remove the text beneath the black highlights:

pdf2ps in.pdf - | ps2pdf - out.pdf

@antonkratz
antonkratz / google.md
Last active January 12, 2023 06:00
Google Hacks

Google Hacks: Gmail, Docs

Gmail

Bookmarks to emails are persistent

You can bookmark individual emails. The bookmarks are persistent, apparently indefinitely (works for me with bookmarks made several years ago).

Add a 30 second delay before the email is actually sent

@antonkratz
antonkratz / symlog_trans.R
Created May 31, 2022 18:14 — forked from davidtedfordholt/symlog_trans.R
A `scales`/`ggplot2` implementation of the `symlog` transformation
#' symlog transformation
#'
#' `symlog_trans()` transforms data using `log(x)` for `abs(x) > thr`, where
#' `thr` is a tuneable threshold, but leaves the data linear for `abs(x) < thr`.
#' (credit for base code to https://stackoverflow.com/users/1320535/julius-vainora)
#'
#'
#' @param base base of logarithm
#' @param thr numeric threshold for transitioning from log to linear
#' @param scale numeric scaling factor for data
@antonkratz
antonkratz / repelling_labels.r
Created August 17, 2021 23:14
Getting coordinates for the label locations from ggrepel, Cytoscape, https://stackoverflow.com/questions/45065567/getting-coordinates-for-the-label-locations-from-ggrepel, tested and works under R 4.1.1
x = c(0.8846, 1.1554, 0.9317, 0.9703, 0.9053, 0.9454, 1.0146, 0.9012, 0.9055, 1.3307)
y = c(0.9828, 1.0329, 0.931, 1.3794, 0.9273, 0.9605, 1.0259, 0.9542, 0.9717, 0.9357)
ShortSci = c("MotAlb", "PruMod", "EriRub", "LusMeg", "PhoOch", "PhoPho",
"SaxRub", "TurMer", "TurPil", "TurPhi")
df <- data.frame(x = x, y = y, z = ShortSci)
library(ggplot2)
library(ggrepel)
p1 <- ggplot(data = df, aes(x = x, y = y)) + theme_bw() +
geom_text_repel(aes(label = z),
@antonkratz
antonkratz / getSmiles.py
Last active October 1, 2021 19:02
From drug NAME to SMILE string
import pubchempy as pcp
import pandas as pd
import numpy as np
from collections import OrderedDict
drugs_df = pd.read_csv('oli_drugs.csv')
def queryPubChem(compounds,batchlist = None,match='name'):
"""
This function queries the PubChem database to retrieve both the isomeric smile and CID of a compound.