Encode/Decode base64
Part of the quest to accept pasted rich text and images from clipboard and save as files or nodes in Leo.
This is the target: https://alex-d.github.io/Trumbowyg/
#!/usr/bin/env python
import base64
import sys
if 'encode' in sys.argv[0].lower():
encode_or_decode = base64.encode
elif 'decode' in sys.argv[0].lower():
encode_or_decode = base64.decode
else :
sys.stderr.write("Error: script name must contain 'encode' or 'decode'!\n")
sys.exit(-1)
if len(sys.argv) > 1: # we have an input file!
inputfile = open(sys.argv[1])
else :
inputfile = sys.stdin
if len(sys.argv) > 2: # we have an output file!
outputfile = open(sys.argv[2], 'w')
else :
outputfile = sys.stdout
encode_or_decode(inputfile, outputfile)
From < http://code.activestate.com/recipes/577626-base64-encode-decode-five-liner/ >
import sys, base64
if len(sys.argv) < 3:
print """Usage: %s in_b64_enc_file out_dec_file
in_b64_enc_file - The Base64 encoded file to be converted
out_dec_file - The output decoded file
"""%sys.argv[0]
sys.exit(0)
base64 .decode(open(sys.argv[1], 'rb'), open(sys.argv[2], 'wb'))
From < http://code.activestate.com/recipes/212198-convert-base64-encoded-embedded-ascii-text-into-bi/ >
Javcascript, uses html5 clipboard API:
HTML5 has a very good file upload API . If your application deals with uploading image files, you can make users life even easier by allowing her to paste image data from the OS clipboard. Here, HTML5 clipboard API will come to the rescue. In this article, we will build a complete implementation.
From < https://mobiarch.wordpress.com/2013/09/25/upload-image-by-copy-and-paste/ >
CODE:
This is an Eclipse project that shows how to upload an image file to server by pasting it in a browser.
From < https://github.com/bibhas2/PasteTest >
django-trumbowyg is the Django-related reusable app for integrating Trumbowyg WYSIWYG editor . It is recognized as one of the best WYSIWYG editors .
From < https://github.com/sandino/django-trumbowyg >
Vue.js component for Trumbowyg WYSIWYG editor
From < https://github.com/ankurk91/vue-trumbowyg >