Skip to content

Instantly share code, notes, and snippets.

View tonyyates's full-sized avatar

Tony Yates tonyyates

  • UK
View GitHub Profile
@tonyyates
tonyyates / contemplative-llms.txt
Created January 20, 2025 20:00 — forked from Maharshi-Pandya/contemplative-llms.txt
"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
What did you do this year that you’d never done before?
Did you keep your new year’s resolutions?
Did anyone close to you give birth?
Did anyone close to you die?
What cities/states/countries did you visit?
What would you like to have next year that you lacked this year?
What date(s) from this year will remain etched upon your memory, and why?
What was your biggest achievement of the year?
What was your biggest failure?
What other hardships did you face?

TMUX

tmux new -s <name> create a new session with <name>\n tmux attach -s <name> attach to a session with <name>\n

ctrl + a = prefix key\n prefix | = split window vertically prefix _ = split window horizontally prefix [ = select previous pane prefix ] = select next pane

@tonyyates
tonyyates / script.sh
Created January 3, 2023 17:35 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@tonyyates
tonyyates / 4 Channel Relay.ino
Created March 17, 2021 14:16 — forked from jmadden91/4 Channel Relay.ino
4 Channel Relay MQTT
//EJ: 4 Relay Switch over WIFI using MQTT and Home Assistant with OTA Support
//EJ: The only way I know how to contribute to the HASS Community... you guys ROCK!!!!!
//EJ: Erick Joaquin :-) Australia
// Original sketch courtesy of ItKindaWorks
//ItKindaWorks - Creative Commons 2016
//github.com/ItKindaWorks
//
//Requires PubSubClient found here: https://github.com/knolleary/pubsubclient
//
@tonyyates
tonyyates / git-archiver.sh
Created October 15, 2019 07:58
Simple bash script for looping through an org and downloading all repos for save keeping
#!/bin/bash
ORG=$1
echo $ORG
mkdir $ORG
cd $ORG
curl -H 'Authorization: token <insert>' -s https://api.github.com/orgs/$ORG/repos | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'
cd ..
tar -cvf $ORG-$(date +%Y-%m-%d).tar.gz $ORG/*
@tonyyates
tonyyates / actions.py
Created February 6, 2019 18:10 — forked from ahmontero/actions.py
Trace the changes made to a django model. You can see how to use it in example.py
# -*- encoding: utf-8 -*-
# --------------------------
# Ripped from django project
# --------------------------
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext as _
from django.utils.encoding import force_unicode
@tonyyates
tonyyates / gist:dd3660edd58aaa658f46282376516d6e
Created July 5, 2018 08:52
drop all tables in a postgres database
DO $$ DECLARE
tabname RECORD;
BEGIN
FOR tabname IN (SELECT tablename
FROM pg_tables
WHERE schemaname = current_schema())
LOOP
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(tabname.tablename) || ' CASCADE';
END LOOP;
END $$;
redirect prefix http://example.com code 301 if { hdr(host) -i www.example.com }
Please see the documentation of the redirect prefix rule for more information.
If you are using a newer version of HAProxy, i.e. at least 1.6, you can use a more generic syntax which allows to redirect any host, not just explicitly named
http-request redirect prefix http://%[hdr(host),regsub(^www\.,,i)] code 301 if { hdr_beg(host) -i www. }
Here, we are using the regsub filter to dynamically generate the correct hostname without the www. prefix.
Code to change a request from / to /app1/
reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2
If urls in the response contain absolute urls it might be required to use this:
acl no_redir url_beg /app1/
reqirep ^([^\ :]*)\ /(.*) \1\ /app1/\2 if !no_redir
The code makes sure that the method and url-path behind the / stays the same. Which method you need exactly might depend on the application thats running.
For readability of the above how change a request from /app1/ to /app1/app1redir/
reqirep ^([^\ :]*)\ /app1/(.*) \1\ /app1/app1redir/\2