Skip to content

Instantly share code, notes, and snippets.

View yrchen's full-sized avatar

Xaver Y.R. Chen yrchen

View GitHub Profile
@Maharshi-Pandya
Maharshi-Pandya / contemplative-llms.txt
Last active March 14, 2025 14:57
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@dechamps
dechamps / bac0-exporter.py
Last active November 1, 2024 15:10
A Prometheus exporter for BACnet device properties using the BAC0 library.
#!/usr/bin/python3 -u
import argparse
argument_parser = argparse.ArgumentParser('Run the HVAC BAC0 server')
argument_parser.add_argument('--local-address', help='local IP address to bind to', required=True)
argument_parser.add_argument('--local-port', help='UDP port to bind to')
argument_parser.add_argument('--bbmd-address', help='IP:port of the BACnet BBMD to register against, if any')
argument_parser.add_argument('--bbmd-ttl', help='TTL of the BACnet foreign device registration, in seconds', type=int)
argument_parser.add_argument('--bacnet-network', help='BACnet network to discover devices on; can be specified multiple times', type=int, action='append', required=True)
argument_parser.add_argument('--prometheus-port', help='Serve Prometheus metrics on this port', type=int)
@tbutts
tbutts / tmux-migrate-options.py
Last active November 27, 2024 08:29
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
import requests
import json
import time
import numpy as np
import os
category = {
'55de818a9d1fa51000f94767': '生活',
'55de818d9d1fa51000f94768': '藝術',
'55de819a9d1fa51000f9476b': '運動',
import requests
import time
from bs4 import BeautifulSoup
import os
import re
import urllib.request
import json
PTT_URL = 'https://www.ptt.cc'
@gregplaysguitar
gregplaysguitar / admin_raw_id.py
Last active October 19, 2022 05:52
Show object description and a link next to django's raw_id_fields, for ForeignKey and ManyToMany fields
"""
Show customisable str representation of the linked objects next to each raw id
field in a django admin change form. Works for ForeignKey, OneToOneField, and
ManyToManyField fields.
Example:
from django.contrib import admin
from admin_raw_id import ImprovedRawIdFieldsAdmin
from .models import MyModel
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active March 16, 2025 19:10
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
export PATH="~/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:$PATH"
export EDITOR=nano
export LANG=en_US.UTF-8
UNAME=`uname`
if [[ $UNAME == "Darwin" ]]
then
export LSCOLORS="gxfxcxdxbxegedabagacad"
alias ls='ls -Gv'
elif [[ $UNAME == "Linux" ]]