Skip to content

Instantly share code, notes, and snippets.

@jag3773
jag3773 / GlusterVolumeInfo
Last active December 3, 2018 06:06
Gluster Volume Checksum Mismatch
[root@ip-172-26-177-115 ~]# gluster volume info
Volume Name: supportgfs
Type: Distributed-Replicate
Volume ID: 695f6857-de4a-441f-bbf1-a57ec047eea6
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: 172.26.178.4:/media/ephemeral0/supportgfs-readonly
wget https://api.unfoldingword.org/obs/txt/1/uW-test-vk.pem
wget https://api.unfoldingword.org/obs/txt/1/en/obs-en.sig
wget https://api.unfoldingword.org/obs/txt/1/en/obs-en.json
@jag3773
jag3773 / gist:d39e1e8b58b86bc4441a
Created February 12, 2015 02:40
Openssl Digital Signature
[jesse@jesse python-ecdsa]$ openssl ecparam -list_curves
secp384r1 : NIST/SECG curve over a 384 bit prime field
secp521r1 : NIST/SECG curve over a 521 bit prime field
prime256v1: X9.62/SECG curve over a 256 bit prime field
[jesse@jesse python-ecdsa]$ openssl ecparam -name secp384r1 -genkey -out sk.pem
[jesse@jesse python-ecdsa]$ openssl ec -in sk.pem -pubout -out vk.pem
read EC key
writing EC key
[jesse@jesse python-ecdsa]$ cat vk.pem
-----BEGIN PUBLIC KEY-----
@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
@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()
>>> 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
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
@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',
@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 / 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