Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mekarpeles's full-sized avatar
📚
Universal Access to All Knowledge

Mek mekarpeles

📚
Universal Access to All Knowledge
View GitHub Profile
@mekarpeles
mekarpeles / git-walkthrough.md
Last active April 22, 2024 17:40
Git aWalkthrough: The ins-and-outs of git

Git Walkthrough

This guide provides a walkthrough of a basic git workflow and attempts to describe what is happening under the hood as commands are run.

  1. We can create a new git repository using git init which creates a hidden directory called .git/
  • The init process fills .git/ with a special file called HEAD that contains the name of the branch or the commit we're on
  • If the contents of the HEAD file is the name of a branch, then we can look in .git/refs/heads/<branchname> e.g. .git/refs/heads/main to figure out the specific commit the branch is on: e.g. ba012fe642b796af4e5735a7e6c83e4e90f9e62b
  • When we first start out, HEAD is likely the main branch which maps to a nil (non-existant) commit
  1. We can stage files to be committed to a checkpoint by using the command: git add and then commit them using git commit -"message".
@mekarpeles
mekarpeles / gutenberg-api.md
Last active October 13, 2023 00:38
Project Gutenberg API
@dataclass
class ImportRecordSchema:
...
class ImportRecord:
def __init__(self, **data):
self.data = ImportRecordSchema(data)
self.validate() # include promise item check, or raise exceptions
self.edition_key = self.find_matching_edition()
self.edition = self.edition_key and web.ctx.site.get(self.edition_key)
@mekarpeles
mekarpeles / goodreads-rss-to-ol-query
Created January 23, 2023 22:29
goodreads rss to ol query
var isbnList = []
fetch("https://www.goodreads.com/review/list_rss/118293813?shelf=%23ALL%23")
.then(response => response.text())
.then(data => {
let parser = new DOMParser();
let xmlDoc = parser.parseFromString(data, "application/xml");
let isbnTags = xmlDoc.getElementsByTagName("isbn");
for (let i = 0; i < isbnTags.length; i++) {
if (isbnTags[i].innerHTML !== "") {
isbnList.push(isbnTags[i].innerHTML);
import requests
"""
- ✅ Show English editions of each
- ✅ Show IA editions of each
- ✅ Show most readable edition
- ❌ They should be in order of publication
- ✅ searching for "chambre des secrets" should
- ✅ Show HP2 somewhere
- ✅ Show French HP2 edition/title
function getBooks(container) {
const reISBN = /((978)?[0-9][0-9]{10}[0-9xX])|((978)?[0-9]{9}[0-9Xx])/;
const elements = document.getElementsByClassName(container);
let isbnElementMap = {};
for (let i=0; i<elements.length; i++) {
let e = elements.item(i);
let match = e.innerHTML.match(reISBN);
if (match) {
isbnElementMap[match[0]] = e;
}
@mekarpeles
mekarpeles / mostrecommendedbooks.js
Created July 20, 2021 23:38
Example of adding Open Library borrow buttons to mostrecommendedbooks.com
function getBooks(container) {
const reISBN = /((978)?[0-9][0-9]{10}[0-9xX])|((978)?[0-9]{9}[0-9Xx])/;
const elements = document.getElementsByClassName(container);
let isbnElementMap = {};
for (let i=0; i<elements.length; i++) {
let e = elements.item(i);
let match = e.innerHTML.match(reISBN);
if (match) {
isbnElementMap[match[0]] = e;
}
@mekarpeles
mekarpeles / book-tags-schema.json
Last active June 27, 2021 18:03
Community Book Tags Schema
{
"categories": [
"pace", "length", "accuracy", "clarity", "enjoyability",
"difficulty", "structure", "type", "impact"
],
"observations": [
{
"label": "pace",
"description": "What is the pace of this book?",
@mekarpeles
mekarpeles / sequencer.py
Last active February 16, 2020 08:08
Basic word frequency for book fulltext
import re
from collections import defaultdict
import string
STOP_WORDS = {'would', 'ourselves', 'hers', 'between', 'yourself', 'but', 'again', 'there', 'about', 'once', 'during', 'out', 'very', 'having', 'with', 'they', 'own', 'an', 'be', 'some', 'for', 'do', 'its', 'yours', 'such', 'in\
to', 'of', 'most', 'itself', 'other', 'off', 'is', 's', 'am', 'or', 'who', 'as', 'from', 'him', 'each', 'the', 'themselves', 'until', 'below', 'are', 'we', 'these', 'your', 'through', 'don', 'nor', 'me', 'were', 'her', 'more', \
'himself', 'this', 'down', 'should', 'our', 'their', 'while', 'above', 'both', 'up', 'to', 'ours', 'had', 'she', 'all', 'no', 'when', 'at', 'any', 'before', 'them', 'same', 'and', 'been', 'have', 'in', 'will', 'on', 'does', 'yo\
urselves', 'then', 'that', 'because', 'what', 'over', 'why', 'so', 'can', 'did', 'not', 'now', 'under', 'he', 'you', 'herself', 'has', 'just', 'where', 'too', 'only', 'myself', 'which', 'those', 'i', 'after', 'few', 'whom', 't'\
, 'being', 'if', 'theirs', 'my', 'against', 'a'
@mekarpeles
mekarpeles / nicks-books-openlibrary.txt
Last active January 20, 2020 04:48
Nick Cammarata's Bookshelf
⭐ Whole Earth Catalog
https://archive.org/search.php?query=whole%20earth%20catalog
⭐ The Mind Illuminated
https://archive.org/details/TheMindIlluminatedByCuladasaJohnYatesPh.D.MatthewImmergutJeremyGraves2017
Salt: A World History
https://openlibrary.org/books/OL7360201M/Salt
⭐ The Dream Machine