Skip to content

Instantly share code, notes, and snippets.

View digitalWestie's full-sized avatar

Rory digitalWestie

View GitHub Profile
@digitalWestie
digitalWestie / AREADME.md
Last active December 20, 2024 18:05
Visualise your commits

gitvis - A git log visualiser in your terminal

image

@digitalWestie
digitalWestie / metadata.md
Created December 18, 2024 13:09
metadata options

In website headers you can link to your chosen licence, e.g. in the case of creative commons:

<link rel="license" href="http://creativecommons.org/licenses/by/4.0/" />

Likewise there's the Dublin core standard version:

@digitalWestie
digitalWestie / text-extract.md
Last active November 19, 2024 12:42
A strategy for recurisvely downloading a site and extracting the text to markdown.

Extracting text

Download site recursively

wget --mirror --convert-links --page-requisites --no-parent -P output_directory https://example.com

Options:

@digitalWestie
digitalWestie / _explainer.md
Last active January 19, 2024 13:05
Rails nested attributes view strategy

Putting related 0 to many resources within a form

For example, we have Paper and EvidenceItem models. We want to let the user add/remove/edit EvidenceItems while they are adding or editing Paper records.

The Paper model looks like this:

class Paper < ApplicationRecord

 has_many :evidence_items, dependent: :destroy
@digitalWestie
digitalWestie / cool_icons_bro.md
Last active April 29, 2025 19:13
Unicode Icon Cheatsheet
@digitalWestie
digitalWestie / titanic.csv
Created September 18, 2023 20:11
Stanford cleaned Titanic passengers dataset
Survived Pclass Name Sex Age Siblings/Spouses Aboard Parents/Children Aboard Fare
0 3 Mr. Owen Harris Braund male 22 1 0 7.25
1 1 Mrs. John Bradley (Florence Briggs Thayer) Cumings female 38 1 0 71.2833
1 3 Miss. Laina Heikkinen female 26 0 0 7.925
1 1 Mrs. Jacques Heath (Lily May Peel) Futrelle female 35 1 0 53.1
0 3 Mr. William Henry Allen male 35 0 0 8.05
0 3 Mr. James Moran male 27 0 0 8.4583
0 1 Mr. Timothy J McCarthy male 54 0 0 51.8625
0 3 Master. Gosta Leonard Palsson male 2 3 1 21.075
1 3 Mrs. Oscar W (Elisabeth Vilhelmina Berg) Johnson female 27 0 2 11.1333
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@digitalWestie
digitalWestie / Scraping-fruit-pictures.md
Last active June 1, 2023 20:39
Scraping and data-prep code for USDA Pomological Watercolour Collection using NodeJS

Creating data-driven fabric designs with JavaScript

P1. Scraping and data preparation with nodejs

You've watched the screencast, here's the code! The screencast starts off with fruit-step-0.mjs, and progresses from there.

The changes for each step are as follows:

  • fruit-step-0.mjs: we start here
  • fruit-step-1.mjs: adds thumbnail url parsing and downloadResults function to download thumbnails from a single result page
  • fruit-step-2.mjs: adds parsing of each result's common name and adds skip condition for apples
@digitalWestie
digitalWestie / normaliser.rb
Last active September 27, 2022 13:18
Country name normaliser
{"Scotlan"=>"Scotland",
"Gb-Sct"=>"Scotland",
"Gb-Eng"=>"England",
"Uk"=>"United Kingdom",
"Usa/Colorado"=>"United States",
"United States of America"=>"United States",
"Texas, Usa"=>"United States",
"Gbr"=>"United Kingdom",
"Uk-Scotland"=>"Scotland",
"UK"=>"United Kingdom",
@digitalWestie
digitalWestie / message_queue.py
Created April 9, 2022 00:17
Experimenting with a message queue system with couchdb.
import threading, time
from cloudant.client import CouchDB
from cloudant.database import CouchDatabase
from cloudant.document import Document
client = CouchDB("username", "password", url="http://couch-main:5984", connect=True, auto_renew=True, timeout=4000)
db = CouchDatabase(client, "channel_queue")
def process_requets(myc):
print("Starting threaded func")
time.sleep(5)