Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#
# This script downloads the Berean Standard Bible and converts it
# to markdown files for an Obsidian vault.
#
# - Each chapter has it's own file, e.g. "Genesis 1.md"
# - A "Bible.md" index file is also created for navigation.
#
# This will output all files into a subdirectory called BSB.
#
@jag3773
jag3773 / gdrive_to_obsidian.py
Created August 26, 2023 16:56
Google Drive File List to Obsidian
#!/usr/bin/env python3
#
# First, install File Cabinet by Awesome Table plugin. Follow their [instructions](https://support.awesome-table.com/hc/en-us/articles/360004223619--Part-2-Use-Files-Cabinet-to-display-Google-Drive-contents) to list all of your Google Drive files + metadata. You should end up with a Google Sheet that has all of your files listed on one or more sheets.
# Second, download the sheet(s) from the above Google Sheet as CSV files (into your Downloads directory).
# Third, modify 'outputdir' (line 11) and the path to your CSV file at the bottom (line 38)
# Fourth, run this script
import csv
from datetime import datetime
#!/usr/bin/env python3
#
# Get CSV from https://www.goodreads.com/review/import
import csv
import os
# change these to match your setup
outputdir = 'YOUROUTPUTDIRECTORY'
goodreadsfile = '~/Downloads/goodreads_library_export.csv'
@jag3773
jag3773 / pre-commit
Last active June 26, 2022 14:45
Scripture Reference Fixer for Obsidian
#!/usr/bin/env bash
# This turns natural references into wiki link references like this:
# Genesis 12:3 -> [[Genesis 12#12:3]]
# Psalm 119:9-11 -> [[Psalm 119#119:9-11]]
# 1 John 3 -> [[1 John 3]]
# First John 1 -> [[1 John 1]]
# Put this file into .git/hooks/ and it will run every time you
# commit into your repository. Make sure it is executable, you can run
# chmod +x .git/hooks/pre-commit
@jag3773
jag3773 / keybase.md
Created January 30, 2016 21:57
keybase.md

Keybase proof

I hereby claim:

  • I am jag3773 on github.
  • I am jag3773 (https://keybase.io/jag3773) on keybase.
  • I have a public key ASDCTGfmirHAZnbI0jIyBwBqtFOpB1zQCsGnUxh_ZiapYwo

To claim this, I am signing this object:

@jag3773
jag3773 / exception
Created May 30, 2015 00:28
uwadmin exception
Environment:
Request Method: POST
Request URL: https://....org/publish/request/
Django Version: 1.7.5
Python Version: 2.7.5
Installed Applications:
['django.contrib.admin',
bash-4.2$ git pull
U _sass/fonts.scss
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
bash-4.2$ git diff
diff --cc _sass/fonts.scss
index 24efdc5,043813c..0000000
--- a/_sass/fonts.scss
+++ b/_sass/fonts.scss
>>> data
{'content': u'https://api.unfoldingword.org/obs/txt/1/es/obs-es.json?date_modified=20141208', 'sig': u'MGUCMQDnCIED/Rzt09WRBvC8ngxLNGOYaWC4dWJkGnuYwkiLYR+hvyogDlx+v+YVaFiRUvcCMGKQD3FjJpspjVJQsbfEW7z2OIOmrGRyDIWzb6TbAnCCj1Gn00JRidI3SgUomSd8eQ==', 'slug': u'uW'}
>>> payload = json.dumps(data)
>>> payload
'{"content": "https://api.unfoldingword.org/obs/txt/1/es/obs-es.json?date_modified=20141208", "sig": "MGUCMQDnCIED/Rzt09WRBvC8ngxLNGOYaWC4dWJkGnuYwkiLYR+hvyogDlx+v+YVaFiRUvcCMGKQD3FjJpspjVJQsbfEW7z2OIOmrGRyDIWzb6TbAnCCj1Gn00JRidI3SgUomSd8eQ==", "slug": "uW"}'
>>> req = urllib2.Request(api, payload, {'Content-Type': 'application/json'})
>>> f = urllib2.urlopen(req)
>>> response = f.read()
>>> f.close()
>>> response
@jag3773
jag3773 / gist:b46a54206d169cd5f086
Created February 16, 2015 19:27
Signing Session
import ecdsa
from ecdsa import SigningKey, VerifyingKey
sk = SigningKey.from_pem(open('uW-test-sk.pem', 'r').read())
payload = open('/var/www/vhosts/api.unfoldingword.org/httpdocs/obs/txt/1/en/obs-en.json', 'r').read()
sig_der = sk.sign_deterministic(payload, sigencode=ecdsa.util.sigencode_der)
f = open('/var/www/vhosts/api.unfoldingword.org/httpdocs/obs/txt/1/en/obs-en.der.sig', 'w')
f.write(sig_der)
f.close()
@jag3773
jag3773 / gist:1cec6c048edf17726226
Created February 16, 2015 17:00
OpenSSL DER Verify
[jesse@jesse crypt]$ wget https://api.unfoldingword.org/obs/txt/1/en/obs-en.json
[jesse@jesse crypt]$ wget https://api.unfoldingword.org/obs/txt/1/uW-test-vk.der
[jesse@jesse crypt]$ wget https://api.unfoldingword.org/obs/txt/1/en/obs-en.der.sig
[jesse@jesse crypt]$ ls
obs-en.der.sig obs-en.json uW-test-vk.der
[jesse@jesse crypt]$ openssl dgst -keyform DER -verify uW-test-vk.der -signature obs-en.der.sig obs-en.json
Verified OK