Skip to content

Instantly share code, notes, and snippets.

@jo
jo / js-crypto-libraries.md
Last active March 31, 2024 20:33
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@jo
jo / replicate.sh
Last active April 16, 2022 14:59
A minimalistic CouchDB replicator in Bash with curl and jq
curl --silent "$source_url/_changes?feed=normal&style=all_docs" \
| jq '.results | reduce .[] as $change ({}; . + { ($change.id): $change.changes | map(.rev) } )' \
| curl --silent -XPOST "$target_url/_revs_diff" -d@- -H 'Content-Type:application/json' \
| jq 'to_entries | reduce .[] as $entry ([]; . + ($entry.value.missing | map({ id: $entry.key, rev: . }))) | { docs: . }' \
| curl --silent -XPOST "$source_url/_bulk_get?revs=true&attachments=true" -d@- -H 'Content-Type:application/json' \
| jq '.results | map(.docs) | reduce .[] as $docs ([]; . + ($docs | map(.ok))) | { docs: ., new_edits: false }' \
| curl --silent -XPOST "$target_url/_bulk_docs" -d@- -H 'Content-Type:application/json' \
| jq
@jo
jo / config.json
Last active January 3, 2019 18:10 — forked from DazWorrall/config.json
Faking RHEV in qemu under packer so that cloud init takes its user data from a floppy disk
{
"builders":
[
{
"type": "qemu",
"output_directory": "output",
"iso_url": "trusty-server-cloudimg-amd64-disk1.img",
"iso_checksum": "cf12c9878c9fb71c95d8f8c288761a99",
"iso_checksum_type": "md5",
"ssh_wait_timeout": "300s",
@jo
jo / README.md
Created April 5, 2017 20:22
Welcome note for Nashi Notes

Welcome to Nashi Notes!

I'm glad you're here and you're reading this.

Your Johannes, TF

@jo
jo / my_code.js
Last active March 9, 2017 09:48 — forked from jefbarn/my_code.js
Using Pouchdb _selector plug-in
import PouchDB from 'pouchdb-browser' // Or however you are importing PouchDB using your module system
PouchDB.plugin((PouchDB) => { // Add the 'plug-in' to the Pouchdb instance
let pouchReplicate = PouchDB.replicate
PouchDB.replicate = (source, target, repOptions) => {
let sourceAjax = source._ajax
source._ajax = (ajaxOps, callback) => {
if (ajaxOps.url.includes('_selector')) {
@jo
jo / README.md
Created November 13, 2012 21:46
Selectable elements

Provide selection capabilities for DOM elements, geared to <select multiple>.

  • click: select element
  • ctrl + click: add element to current selection
  • click + move: select elements while dragging
  • ctrl + a: select all elements within focused list
  • ctrl + shift + a: deselect all elements within focused list
  • ctrl + click + move: toggle selection while dragging
  • shift + click: select range from nearest last selected element to clicked element
  • shift + ctrl + click: add range to current selection
--53189632b3ce5de9dea79cb967b6e0c7
Content-Type: application/json
{"_id":"gnome-rust-couchdb-adventures:text","_rev":"1-45fa252f660e886b336c780f328b0810","text":"Hello CouchDB!"}
--53189632b3ce5de9dea79cb967b6e0c7
Content-Type: application/json
{"_id":"gnome-rust-couchdb-adventures:text","_rev":"2-f0216b155efdac3278a570f594ab0d83","text":"Hello CouchDB!\n<3"}
--53189632b3ce5de9dea79cb967b6e0c7--
@jo
jo / glxinfo
Last active March 9, 2016 11:37
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
@jo
jo / package.json
Last active January 20, 2016 20:49
{
"name": "hello-import",
"version": "1.0.0",
"scripts": {
"build": "rollup -c"
},
"author": "Johannes J. Schmidt <jo@die-tf.de> (http://die-tf.de/)",
"license": "Apache-2.0",
"devDependencies": {
"events": "^1.1.0",
@jo
jo / gist:5012357
Created February 22, 2013 10:21
grunt node-qunit
Running "node-qunit" task
TypeError: Cannot read property 'path' of undefined
at absPath (/home/jo/github/daleharvey/pouchdb/node_modules/grunt-node-qunit/node_modules/qunit/lib/testrunner.js:101:13)
at exports.run (/home/jo/github/daleharvey/pouchdb/node_modules/grunt-node-qunit/node_modules/qunit/lib/testrunner.js:146:21)
at Array.forEach (native)
at Object.exports.run (/home/jo/github/daleharvey/pouchdb/node_modules/grunt-node-qunit/node_modules/qunit/lib/testrunner.js:141:11)
at Object.module.exports (/home/jo/github/daleharvey/pouchdb/node_modules/grunt-node-qunit/tasks/node-qunit.js:14:9)
at Object.task.registerTask.thisTask.fn (/home/jo/github/daleharvey/pouchdb/node_modules/grunt/lib/grunt/task.js:58:16)