Skip to content

Instantly share code, notes, and snippets.

View birkin's full-sized avatar

Birkin James Diana birkin

View GitHub Profile
@birkin
birkin / ok_to_buy_non_tesla_EVs_again.md
Last active June 12, 2023 02:55
recent email to some friends, sparked by GM's recent announcement that it'll adopt the NACS fast-charger plug.

Go Forth and Purchase a non-Tesla EV!

2023-June-11

Hi all,

With the announcement by General Motors this past Thursday that it will adopt the North American Charging Standard (NACS) fast-charger -- giving it access to Tesla's fast-chargers -- I can officially once again whole-heartedly evangelize non-Tesla EVs! (From Ford & GM; Ford announced the same two weeks ago.)

Some of you may remember that a few months ago I had said that I was terribly disappointed that I could no longer freely recommend buying a non-Tesla EV if...

@birkin
birkin / get_solr.py
Created June 2, 2023 19:41
python to solr
Sure, I can give you a Python function to achieve that. However, please note that this function is a simple demonstration and you may need to modify it according to your actual use case. For example, error handling, exception handling, and managing API rate limiting are not included in the following example.
Let's assume the URL you are using is `http://solr-url/api`, and there is a query parameter, let's say `start`, which you can use to specify the starting point for each batch of items. Also, let's assume that the Solr API returns JSON with a field `items` that contains the items you're interested in.
```python
import requests
import time
def get_all_solr_items(base_url, batch_size=500):
all_items = []
@birkin
birkin / questions.md
Last active May 19, 2023 02:35
health jeopardy-style questions from chatgpt-4.

list 10 questions (for 7th-graders) in jeopardy-format about "food-labels & food-storage" -- and provide answers.

Sure, here are ten Jeopardy-style questions (answers first, questions second) about food labels and food storage suitable for a 7th-grade level of understanding:

  1. Answer: The Nutrition Facts Label

    Question: This section of a food package provides information about the calories and nutrients in the product.

@birkin
birkin / python_set_date.md
Created May 17, 2023 19:00
setting a file's creation-&-modification date via python.

Prompt

using python, how would I change a file creation-date for a pdf?


Response

Modifying a file's creation time isn't a standard operation because it's not a common need and it can potentially cause issues. However, it is possible to do this using the Python os and datetime modules, specifically using the os.utime function.

@birkin
birkin / chatgpt_and_grep.md
Created May 17, 2023 11:06
chatgpt helps with grep syntax.

Prompt

In unix, what's a grep/regular-expression command to search a directory for files containing a string like "b1234567", where the first character is a lowercase "b", followed by seven numerals?

Response

You can use the grep command with the -r (or --recursive) option to search a directory recursively. To find a pattern like "b1234567", where the first character is a lowercase "b", followed by seven numerals, you can use the regular expression b[0-9]{7}. Here's how to put it all together:

@birkin
birkin / rust_shared_reference_move.md
Last active May 17, 2023 11:07
explanation of rust shared-reference & move concepts.

Prompt

this Rust line works...

title = subfield.value.clone().unwrap_or_else(|| "".to_string());

...and this doesn't:

title = subfield.value.unwrap_or_else(|| "".to_string());

@birkin
birkin / chatgpt_math.md
Last active May 5, 2023 21:15
exploring chatgpt-4's math operations

ChatGPT-4 math...

fyi, the answer, via python...

>>> format( (65 * 845 * 78 * 150 * 987 * 5 * 654 * 78 * 522), "," )
'84,447,333,008,847,900,000'

@birkin
birkin / mysql_collation.md
Created May 4, 2023 12:47
asked chatgpt to compare two mysq unicodel collations.

background

For the stolen-relations project, we're doing some programmatic data-cleaning. I recently uploaded test sql to an empty database and examined the load in phpMyAdmin.

I noticed that the collation for the few updated tables had changed from the utf8mb4_unicode_520_ci encoding I've ensured all my sql tables use for the last few years. The updated tables are using the collation utf8mb4_0900_ai_ci.

So I asked chatGPT about the differences, and then did a few google searches to verify the info. Over time, I'll move collations to this utf8mb4_0900_ai_ci collation.


@birkin
birkin / timeline-js_question.md
Last active May 3, 2023 15:48
inserting a date into a set of static dates for timeline.js

Prompt...

i want to use timeline.js and pass it a date and have it display that date on a timeline with other static pre-populated dates.


Response...

To achieve this, you can use TimelineJS, an open-source tool developed by Knight Lab that allows you to build visually-rich, interactive timelines using a simple JSON or Google Sheets data source. In this example, I'll show you how to create a timeline using a JSON data source, including your static pre-populated dates and the date you want to pass.

@birkin
birkin / chatGPT_explains_describe_and_it.md
Created April 13, 2023 20:23
explains `describe` and `it` in context of javascript testing.

User:

i just saw this js code: "import { describe, it } from 'node:test'" -- can you explain how javascript/node uses "describe" and "it"?


ChatGPT:

This code snippet is related to testing in JavaScript, specifically using the Mocha testing framework. Mocha is a popular testing library for Node.js applications, and it provides a clean and easy way to organize and structure your tests.