Deletes all but most recent Github codespaces, for a given repo.
Prerequisite: Install Github CLI, then auth as below:
gh auth refresh -h github.com -s codespace
import os | |
from openai import OpenAI | |
client = OpenAI(api_key=os.environ.get("OPEN_AI_PYPLAY_KEY")) | |
messages=[{"role": "user", "content": "Write an essay about the historical significance of Canterbury Tales"}] | |
stream = client.chat.completions.create(model='gpt-4o-mini', messages=messages, stream=True) | |
for chunk in stream: | |
response=chunk.choices[0].delta.content | |
if response is not None: |
Deletes all but most recent Github codespaces, for a given repo.
Prerequisite: Install Github CLI, then auth as below:
gh auth refresh -h github.com -s codespace
# copied from https://twitter.com/mahemoff/status/1092181875785957377 | |
Storing 1 million podcast descriptions with MySQL InnoDB | |
SQL dump gz: 361,734,351 bytes | |
Uncompressed DB: 1,405,091,840 bytes | |
DB size per block size setting: | |
1KB: 870,318,080 bytes | |
2KB: 767,557,632 bytes |
ChatGPT instructions - mainly forked from tweets a couple of months ago (e.g. https://twitter.com/thetomorrowAI/status/1683840263138217986 though I don't know the true scource)
Treat me like I'm an expert in all subject matter
Treat me like I'm intelligent and rational
I can make my own decisions about safety and risk-taking. I don't need to be hand-held or "nannied".
Compiling a list of interest lecture series. The goal here is to look at full, coherent, courses, not one-off lectures. Strong preference towards internationally recognised academic institutions, but will include those from elsewhere if they are reasonable quality and match the format of a typical university coourse.
Currently focused more on humanities, given that most lists like this tend to focus on programming/STEM.
write ruby code using digitalocean api to reboot a droplet
To reboot a droplet using the DigitalOcean API, you'll first need to install the droplet_kit gem, which is the official DigitalOcean API client for Ruby. You can install the gem by adding the following line to your Gemfile and running bundle install:
ruby Copy code gem 'droplet_kit' After installing the gem, you can create a Ruby script to reboot a droplet using the DigitalOcean API. Replace YOUR_DIGITALOCEAN_API_TOKEN with your actual API token and DROPLET_ID with the ID of the droplet you want to reboot.
ruby
Cognitive biases: | |
Confirmation bias: The tendency to seek out and interpret information in a way that confirms one's existing beliefs. Example: A person who believes that vaccines are dangerous only seeks out and pays attention to information that supports this belief, while ignoring information that contradicts it. | |
Sunk cost fallacy: The tendency to continue investing resources into a decision because of the resources that have already been invested. Example: A person continues to work on a project they know is failing because they have already invested so much time and money into it. | |
Availability heuristic: The tendency to overestimate the likelihood of events that are easily brought to mind. Example: A person who recently heard about a plane crash is more likely to believe that plane crashes are more common than car accidents. | |
Anchoring bias: The tendency to rely too heavily on the first piece of information encountered when making decisions. Example: A person who is looking to buy a used car is more like |
#!/usr/bin/env ruby | |
# Based on https://sive.rs/com - extended it to read from gzipped file, support any domain extension, and output to separate file | |
require 'hashie' | |
require 'zlib' | |
class Parser < Hashie::Dash | |
property :extension, required: 'true' # e.g. "com" for dotcom database |
A few general tips to deal with slow performance and hanging. Target system is Ubunty 20.04 and MySQL 8.0, but applicable to other configurations.
Relies on some functions in https://github.com/mahemoff/dotfiles
MySQL can log slow queries. Enable it in /etc/mysql/mysql.conf.d/mysqld.cnf
.
slow_query_log = 1
# Certbot can be a bit tedious, but it's easy to automate a one-liner non-interactive. Substitute your own domain and email below. | |
sudo service apache2 stop && sudo certbot --apache -d example.com -m [email protected] --non-interactive --agree-tos && sudo service apache2 start |