Skip to content

Instantly share code, notes, and snippets.

View capjamesg's full-sized avatar
writing code

James capjamesg

writing code
View GitHub Profile
# make BookParts directory
rm -r BookParts && rm book.pdf
if [ ! -d "BookParts" ]; then
mkdir BookParts
fi
if [ ! -d "BookParts/new" ]; then
mkdir BookParts/new
fi
@capjamesg
capjamesg / hitem-reader.py
Created October 11, 2022 07:33
A script to count specified mf1 and mf2 properties from a string.
import json
import mf2py
def checker(mf2prop, mf1prop, filename):
with open(filename, "r") as file:
file_names = list(file.readlines())
counter = 0
# draft of autotag function for use in indieweb-utils
import re
def _match_tag(tag_prefix: str, match: re.Match, user_tags: dict) -> str:
"""
Match a tag and return a link to the tag page.
:param tag_prefix: The prefix to append to the tag.
import re
note = "I am presently having coffee with @example. #coffee #lunch #breakfast" #* 10000
person_tags_reference = {
"example": ("Example Person", "example.com/bio"),
}
tags = ["coffee", "lunch", "breakfast"]
# Adapting https://gist.github.com/angelogladding/c61488d2dd82fb73b9078541a4e2ea13 for library use
import re
from urllib.parse import urlparse
REST = r"(?P<rest>.*)"
DOMAIN_PATTERN = r"^(?P<domain>\w.[^/]+)/" + REST
url_summary_templates = {
"github.com": [
# Adapting https://gist.github.com/angelogladding/c61488d2dd82fb73b9078541a4e2ea13 for library use
import re
REST = r"(?P<rest>.*)"
DOMAIN_PATTERN = r"^http[s]?://(?P<domain>\w.[^/]+)/" + REST
url_summary_templates = [
(
r"http[s]?://github.com/(?P<user>\w+)/(?P<project>[\w-]+)/",
from urllib.parse import urlparse
url = "https://github.com/capjamesg/indieweb-utils/pulls/1"
def _python_pull_request(path):
if len(path) > 2 or path[2] != "pulls":
return "A comment on a pull request in the " + path[1] + " GitHub repository."
def _python_generic_comment(path):
if len(path) >= 1:
# Code to advance discussion around url_summary implementation
# Still in development
from urllib.parse import urlparse
url = "https://github.com/capjamesg/indieweb-utils/pulls/1"
callbacks = {
"github.com": [
lambda path: "A comment on pull request " + path[1] if len(path) > 2 and path[2] == "pulls" else "",
SELECT COUNT(page) AS mf2_count FROM `httparchive.all.pages` WHERE date = "2022-08-01" AND payload LIKE "%authorization_endpoint%";
@capjamesg
capjamesg / gist:9a0ff6c443286abe7c9223d754665c6b
Created September 21, 2022 20:45 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: