Skip to content

Instantly share code, notes, and snippets.

@brumar
brumar / systemprompt_studymode.md
Created July 29, 2025 20:33
openAI study mode (unconfirmed)

"You are ChatGPT, a large language model trained by OpenAI. Knowledge cutoff: 2024-06 Current date: 2025-07-29

Image input capabilities: Enabled Personality: v2 Engage warmly yet honestly with the user. Be direct; avoid ungrounded or sycophantic flattery. Maintain professionalism and grounded honesty that best represents OpenAI and its values.

Tools

@brumar
brumar / hook.sh
Created June 5, 2025 13:49
shell script to get claude code a bit more "--max-turns" conscious
#!/bin/bash
# insist in your CLAUDE.md to get claude code call this as much as possible
# If CLAUDE.md indicates existing commands, add || ./hook.sh <<args>> at each.
# Usage: ./hook.sh <log_dir> <max_turns> [threshold]
# Example: ./hook.sh .jbsays/logs/ 30 5
log_dir="$1"
max_turns="$2"
@brumar
brumar / dependent_cached_prop.py
Created April 2, 2023 19:58
cached property that gets invalidated if some other attributes change (for el senior jbbb)
from _thread import RLock
_NOT_FOUND = object()
# Most of the code comes from the standard library (cached_property decorator)
# Warning: the dependent properties that get listed must be hashable!
def dependent_cached_prop(on=[]):
def decorator(func):
@brumar
brumar / prepend_path_to_annotations.py
Created January 17, 2022 18:14
fix pyannotate annotations by changing relative paths to absolute paths
import json
from pathlib import Path
if __name__ == "__main__":
dico = json.load(Path("./annotations.json").open())
for element in dico:
element["path"] = str(Path(__file__).parent) + "/" + element["path"]
json.dump(dico, Path("./annotations_2.json").open("w"))
@brumar
brumar / main.py
Last active April 21, 2021 14:45
minimalist example to mount pywebio application on an existing fastapi application
"""Install these requirements
pip install git+https://github.com/wang0618/PyWebIO fastapi starlette uvicorn aiofiles websockets
and run
python main.py
"""
import uvicorn
from fastapi import FastAPI
@brumar
brumar / wsgi_pythonanywhere_apistar.py
Last active August 7, 2017 08:46
pythonanywhere WSGI launcher for api star 0.1.17
# 1/ New Web App -> Custom WSGI
# 2/ Open var/www/your_username_pythonanywhere_com_wsgi.py
# 3/ Comment all active code and paste this one
from apistar import app as appstar
import sys
path = "/home/path/to/you/apistar_project" # change this line
if path not in sys.path:
sys.path.append(path)
import app as myapp
@brumar
brumar / main.py
Created November 30, 2016 21:25
v1 of a cli used remember each day of my live
import os
import sys
from datetime import timedelta, date, datetime
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import ftplib
import argparse
import subprocess
@brumar
brumar / gist:5e9985f36c5447bfd472
Created April 16, 2015 19:52
very light chess game encoder for arts of memory lover -- based on https://pypi.python.org/pypi/pgnparser/1.0
# -*- coding:utf-8 -*-
# Copyright (c) 2011 Renato de Pontes Pereira, renato.ppontes at gmail dot com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#