Skip to content

Instantly share code, notes, and snippets.

View boxabirds's full-sized avatar

Julian Harris boxabirds

View GitHub Profile
WhatsMyColorIntent what's my favourite colour
WhatsMyColorIntent what is my favourite colour
WhatsMyColorIntent what's my colour
WhatsMyColorIntent what is my colour
WhatsMyColorIntent my colour
WhatsMyColorIntent my favourite colour
WhatsMyColorIntent get my colour
WhatsMyColorIntent get my favourite colour
WhatsMyColorIntent give me my favourite colour
WhatsMyColorIntent give me my colour
Sub ROT13UX()
' Obscure material on screen temporarily.
' Problem: how do I share screens and avoid accidental sharing of content?
Selection.text = ROT13(Selection.text)
End Sub
' Formatting preserved (yay)
Function ROT13(ByRef text As String)
Const kLowerCaseStart = 97
Const kAlphabetRange = 26
@boxabirds
boxabirds / Dockerfile
Created June 2, 2017 15:07
Tensorflow data science Jupyter image
# commands to set up the Docker image
FROM tensorflow/tensorflow:latest
# for natural language processing
RUN pip install nltk
# general data analysis (statistical: like R for python)
RUN pip install pandas
# interesting visualisations
@boxabirds
boxabirds / conftest.py
Created December 8, 2019 13:19
pytest.mark.chargeable: exclude tests that may incur a charge from the cloud provider
# inspired by example in https://docs.pytest.org/en/latest/example/simple.html
import pytest
def pytest_addoption(parser):
parser.addoption(
"--runchargeable", action="store_true", default=False, help="run tests that may incur a charge"
)
const fs = require('fs');
const path = require('path');
async function create_file_in_new_folder_with_promises() {
try {
await fsp.mkdir(path.join(__dirname, '/promise-test'));
await fsp.writeFile(
path.join(__dirname, '/promise-test', 'writeFile-promise-demo.txt'),
"Hello world from the land of promises"
);
@boxabirds
boxabirds / dart
Last active March 16, 2024 04:48
Flutter build a GET request with parameters
// How do you make a Flutter HTTP GET request with parameters?
// Most examples have no parameters or have parameters embedded in the URL.
// This took me hours to find so here we go
// no prototcol or slashes
// path and parameters are both properly URL encoded.
// Uri is part of dart:core
import 'package:http/http.dart' as http;
@boxabirds
boxabirds / gist:35b64ed736cdaf726e3ec16498a47436
Created June 10, 2020 16:30
Never include moto in your production dependencies "PythonPipBuilder:ResolveDependencies - WARNING: pip is being invoked by an old script wrapper"
https://github.com/spulec/moto is great for mocking out AWS,
but I accidentally had it included in requirements.txt instead of a dev dependency.
Completely insane cryptic messages when calling sam build.
@boxabirds
boxabirds / scrapinghub-http-200-on-error
Created November 5, 2020 20:17
Scrapinghub.com when given a non-HTML URL (specifically a PDF) barfs and it's unclear how to detect this short of hacking the text (which could change)
DEBUG urllib3.connectionpool:connectionpool.py:442 https://autoextract.scrapinghub.com:443 "POST /v1/extract HTTP/1.1" 200 None
DEBUG root:article.py:247 Download time took 3.2365484610000004s
DEBUG root:article.py:249 {
"query": {
"id": "1604607287688-bc624d2ae5f0dbd1",
"domain": "netlify.app",
"userQuery": {
"url": "https://lisn-tests.netlify.app/pdf.pdf",
"pageType": "article"
}
@boxabirds
boxabirds / trafilatura.py
Created March 24, 2021 21:20
Simple test of trafilatura
from trafilatura.core import bare_extraction, extract
from pathlib import Path
import json
from sentence_splitter import SentenceSplitter
html_path = Path("data") / "testfile-3.html"
html = html_path.read_text()
result_json_text = extract(
output_format="json",
filecontent=html,
@boxabirds
boxabirds / fact-finder.prompt.txt
Created January 30, 2024 13:41
A prompt for asking questions and producing structured results including a summary.
# Assistant
- The Assistant is a chatbot designed to engage in conversation with a user.
- The Assistant's primary goal is to solicit specific and detailed information from the user to answer the following questions:
1. Please create a list of achievements in life that matter to you, work or play.
2. Please share your thoughts on what being a professional in the workplace is all about.
3. What do you think are milestones that led to your current career path.
4. What are your thoughts on work/life balance.
5. Please list a few people you consider to be great inspirations, and why.
# Strategy