dev-paste


< PRE-DRAFT+ >
< #DEV >

Python tool & general methods: decoupage effectively across different hypertextual domains, "web platforms", syntaxes, formats, etc.

Revisions:

    _____________ as dev-xclip
    20191008 import from dcht00🔗python-clipboard-copypaste
    _____________ as XXX🔗cuts
    20200929 stub
    20210125 trying for telegram
    20210216 still around
    20220511 added instagram
    _____________ as dev-hyperpaste
    xxxx
    20200603 stub ("e2h-paste")
    20210311 moving (source) docs in here
    20220303 ping, cleanup
    20220317 ping
    20220511 merged in old XXX🔗cuts

Ties to:
    aka "dev-xclips"
    aka "dev-clipboard"
    ______________ other tools
    🔗polemics, XXX🔗polemics
    🔗dev-keyclusters
    ______________ using
    #CUTS
    #RAW
    🔗postchatter, XXX🔗postchatter
    XXX🔗debates (instances) → 🔗arguments (distilled)
    #writeups


Table of Contents
1 *** METHOD PER-PLATFORM
1.1 * TELEGRAM 1
1.2 * TELEGRAM 2: IN-PLACE MARKING SYMBOL + FIND
1.3 Telegram try #3
1.4 * INSTAGRAM
2 *** TODO
2.1 [a!!] TOOL— Useful plain text & text/html targets, side-by-side
2.2 [K] cleanup bullshit from URLs
2.3 [K] Paste Facebook URLs without their shit
2.4 [M!!] ### MERGE ... VIA BURNER
2.5 [K] remapping to keyboard in ubuntu:
2.6 [!!!] set any target within python (not with xclip)
2.6.1     [!!**] DEV— RESEARCH GTKSELECTIONDATA, AND WHAT TO DO WITH IT:
2.6.2     [!!!**] ... a set non-text target
2.7 [!!!*] EXPLORE xclip COMMAND
2.7.1     [!!!*] maybe this one does it for HTML !
2.8 [!] REMAP TO "MIDDLE CLICK" :)
2.9 [!!] E2H MODE
2.9.1     [!!] wikipedia → E2H
2.9.2     [!**] STYLED HTML → E2H
2.9.3     [!!**] chat tools (element, telegram, etc) → E2H
2.9.4     [!] FB SHIT URL → E2H
2.10 [!] DEV— What is "text/x-moz-url-priv" target?
2.11 [!] FEATURE— work with drag and drop
2.12 [~] FEATURE— ... even for images! auto uploading them!
2.13 [!] CASE— ally.wiki
2.14 [!] CASE— hiperdino order confirmation mail (2021-07-06 for example)
2.15 [!!*] CASE— wiki styling→e2h: soweto uprising
2.16 —————
2.17 [!!**] CASE/CUTS— copy TWEET / YOUTUBE link, get EXPANDED COPY BUFFER
2.18 [!!**] CASE/CUTS— make ROUGH COPY, get cleaned up
2.19 [!**] CASE/CUTS— Long text
2.20 [~] CASE— (some mailing list trash)
2.21 [!!*] BUG/WIKI— handling "]" closing brackets
2.22 CASE— Remove tracking trash
2.23 [!*] Work with SECONDARY BUFFER (selection)
2.24 [!] HACK— THE CONCEPT (select → middle click in terminal → kaboom)
2.24.1     [!*] can you include control characters in copy buffer, like ctrl+alt+T
2.24.2     [!] can you induce delays in "pasting"?
2.24.3     [!] getting the gritty HTML buffer in SELECTION buffer
2.25 [e!!*] UX/INTERACTIVE— On-screen display
2.26 [!!] ###— multi-buffer
2.27 [!!**] ALIKE/101— Find tools for copying/annotating from social media chats
3 *** PAD
3.1 (MORE DOCS)
3.2 (ETHERPAD EXAMPLE WORKS!)
3.3 [!!*] ALIKE— clipboard "noiser" in python
3.4 [!!!**] [RAW] 20220303 DOES NOT WORK
3.4.1     (A) BEFORE set_properlly
3.4.2     (B) AFTER set_properly
3.4.3     → CONCLUSIONS [!!!**]
3.5 [!→→] PROJECT— The old "copy buffer" hack idea
3.6 $ xclip -o -t TARGETS
3.7 [!*] pasting images is possible in twitter !:
3.8 [!→] cycling windows with "wmctrl"
3.9 (MOCK EARLY CODE, from "dev-xclip")
3.10 (dev-xclip sources)
3.11 CASE— (zima/yuan statut does NOT copy well)



*** METHOD PER-PLATFORM


* TELEGRAM 1

next:
    * CHECK NON-STANDARD CLIPBOARD !!!

____________

(FOR STANDARD CLIP)

problems:
    * you will lose bolds, images, gifs, reactions, sounds etc
    * MESSAGE QUOTES will fuck it up

so:
    * all blocks of author are together:
        """
        __________
        David
        blablabla
        blublueblu
        __________
        Lies
        """
    * mesage quotes:
        """
        __________
        Lies
        David
        blablabla
        really
        __________
        David
        yes
        """
        * cut at 129
        * only first line

do:
    * copy all to gedit

solving QUOTES:
    A) by matching beginnings of lines strings, and cut at 129 !!!
    B) ###



* TELEGRAM 2: IN-PLACE MARKING SYMBOL + FIND

1) when you have something to cut, add:
    "———[some topic]"

2) when it's done add "K" at end

3) also mark the ends

4) edit in place, while you're still in telegram. try to make it good.

5) later, CTRL+F to find good cuts.



Telegram try #3

* use laptop
* scroll up
* select all
* copy to gedit

* cleanup:
    ???

* read and:
    * structure (B, B+I, ...)
    * annotate (@@, #, →→)
    * ... other fragment marks via XXX🔗syntax
    * mark NOW points 
    * [...]


____________________________

either:
    A) make sure stuff actually gets moved
    B) #mima.case (mima does it)




* INSTAGRAM

20220511: it just works!

Scroll up, copy+paste.
Missing:
    * who is who
    * timing


<----------------------------------------- (new) KNOW-HOW (per platform) ↑





*** TODO


[a!!] TOOL— Useful plain text & text/html targets, side-by-side

https://html-online.com/editor/
(paste formatted text and see the html as well as seeing it rendered)



[K] cleanup bullshit from URLs
:
    * facebook ("fbid", etc)
    * google search results
    * [...]


[M!!] ### MERGE ... VIA BURNER
        i wrote around yesterday 20210309/10 ???
        (i spoke about +matic on telegram too)
        includes ideas like:
            * pre-define regexes
            * work with SELECTION buffer, be able to auto-define transformation:
                imagine - you select something, wait a bit and it auto-cleans up
                ... based on some ... keyboard combos, or parameters you're checking on/off
            * [...]

________________________

SANITY CHECKS:
    * pasting wiki or website →E2H links works
    * strong/italic/etc are not lost
    * cleaning up pasted URLs with facebook/social media crap in them !!!


[K] remapping to keyboard in ubuntu:
    see /DEV/key-combinations (20210310)



[!!!] set any target within python (not with xclip)


    [!!**] DEV— RESEARCH GTKSELECTIONDATA, AND WHAT TO DO WITH IT:

https://developer.gnome.org/gtk3/stable/gtk3-Selections.html
https://developer.gnome.org/pygtk/stable/class-gtkclipboard.html#method-gtkclipboard--set-with-data 
###

anything else in the GtkSelectionData ???


    [!!!**] ... a set non-text target

→ "text/html" = WIN !


[!!!*] EXPLORE xclip COMMAND

$ xclip -selection primary -o -t TARGETS
THIS IS PROBABLY THE ONE

$ xclip -selection secondary -o -t TARGETS

$ xclip -selection clipboard -o -t TARGETS
    TIMESTAMP
    TARGETS
    MULTIPLE
    SAVE_TARGETS
    text/html
    text/_moz_htmlcontext
    text/_moz_htmlinfo
    UTF8_STRING
    COMPOUND_TEXT
    TEXT
    STRING
    text/x-moz-url-priv


    [!!!*] maybe this one does it for HTML !

$ xclip -selection clipboard -o -t text/html | __copy






[!] REMAP TO "MIDDLE CLICK" :)



[!!] E2H MODE

    [!!] wikipedia → E2H

(especially links!)

    [!**] STYLED HTML → E2H


    [!!**] chat tools (element, telegram, etc) → E2H


    [!] FB SHIT URL → E2H



[!] DEV— What is "text/x-moz-url-priv" target?


[!] FEATURE— work with drag and drop


[~] FEATURE— ... even for images! auto uploading them!


[!] CASE— ally.wiki
https://ally.wiki (fucking gdocs!)


[!] CASE— hiperdino order confirmation mail (2021-07-06 for example)
    1) copy but in a sensible excel-import ready format
    2) also fetch the images
    ------------
    this might inckude an "import configuration" screen



[!!*] CASE— wiki styling→e2h: soweto uprising

Use the first paragraph of ...
https://en.wikipedia.org/wiki/Soweto_uprising

"""
The Soweto uprising was a series of demonstrations and protests led by black school children in South Africa that began on the morning of 16 June 1976.[1]
"""

↓↓↓

"""
<meta http-equiv="content-type" content="text/html; charset=utf-8"><p>Students from numerous Sowetan schools began to protest in the streets of <a href="https://en.wikipedia.org/wiki/Soweto" title="Soweto">Soweto</a> in response to the introduction of <a href="https://en.wikipedia.org/wiki/Afrikaans" title="Afrikaans">Afrikaans</a> as the <a href="https://en.wikipedia.org/wiki/Medium_of_instruction" title="Medium of instruction">medium of instruction</a> in local schools.<sup id="cite_ref-2" class="reference"><a href="https://en.wikipedia.org/wiki/Soweto_uprising#cite_note-2">[2]</a></sup> It is estimated that 20,000 students took part in the protests. They were met with fierce <a href="https://en.wikipedia.org/wiki/Police_brutality" title="Police brutality">police brutality</a>. The number of protesters killed by police is usually given as 176, but estimates of up to 700 have been made.<sup id="cite_ref-3" class="reference"><a href="https://en.wikipedia.org/wiki/Soweto_uprising#cite_note-3">[3]</a></sup><sup id="cite_ref-Harrison_1987_4-0" class="reference"><a href="https://en.wikipedia.org/wiki/Soweto_uprising#cite_note-Harrison_1987-4">[4]</a></sup><sup id="cite_ref-5" class="reference"><a href="https://en.wikipedia.org/wiki/Soweto_uprising#cite_note-5">[5]</a></sup> In remembrance of these events, 16 June is now a public holiday in South Africa, named <a href="https://en.wikipedia.org/wiki/Youth_Day#South_Africa" title="Youth Day">Youth Day</a>.<sup id="cite_ref-6" class="reference"><a href="https://en.wikipedia.org/wiki/Soweto_uprising#cite_note-6">[6]</a></sup>

Students from numerous Sowetan schools began to protest in the streets of Soweto in response to the introduction of Afrikaans as the medium of instruction in local schools.[2] It is estimated that 20,000 students took part in the protests. They were met with fierce police brutality. The number of protesters killed by police is usually given as 176, but estimates of up to 700 have been made.[3][4][5] In remembrance of these events, 16 June is now a public holiday in South Africa, named Youth Day.[6] 
"""


—————


[!!**] CASE/CUTS— copy TWEET / YOUTUBE link, get EXPANDED COPY BUFFER
(title, author, cleaned link, etc)


[!!**] CASE/CUTS— make ROUGH COPY, get cleaned up

IN: rough copy a tweet (over the time including link)
OUT: something orderly


[!**] CASE/CUTS— Long text

https://www.marxists.org/archive/lukacs/works/1943/hegel-nazis.htm
* lines broken
* delimiters not properly exposed (#HEADERING)
* ###


[!!*] BUG/WIKI— handling "]" closing brackets

"""
A concept that we can perceive as critique and mostly as renewal is the concept of coloniality (Anibal Quijano, 2000, Nepantla, Coloniality of power, eurocentrism and Latin America).[47] 
"""
Solution → escaping!


[!*] Work with SECONDARY BUFFER (selection)

* primary buffer = copied
(aka COPY BUFFER)

* secondary buffer = selected
(aka SELECTION BUFFER)



[!] HACK— THE CONCEPT (select → middle click in terminal → kaboom)
#oldie [m!]
The idea is that selecting or "pasting with middle click" could trigger commands


* can you keep & change focus?
UPDATE— not sure what i meant here ↑


    [!*] can you include control characters in copy buffer, like ctrl+alt+T


    [!] can you induce delays in "pasting"?


    [!] getting the gritty HTML buffer in SELECTION buffer



[e!!*] UX/INTERACTIVE— On-screen display

Show on-screen what is copied & what it could change into.

Exciting!

* Query buffer every second!
* Use "zev" or something for prototype!
* Offer different reform options!
* Implement "multi-buffer" with this!
* ###


[!!] ###— multi-buffer

(several paste options + management)



[!!**] ALIKE/101— Find tools for copying/annotating from social media chats

It's like ... hyperphotos for social media!

* mass download
* easy annotate
* [...]


<------------------------------------------ (new)+ TODO ↑






*** PAD


(ETHERPAD EXAMPLE WORKS!)

GIVES:

    """
    <div id="magicdomid14" class="ace-line"><span class="author-a-0tz122za1z90zz82z4uicz88ztqpz75z b"><b>You are interested to come or visit</b></span><span class="author-a-z88zhz73zjbtpz76zz76zz82zz72zz73zvbyz90z b"><b> sometime ...</b></span></div><div id="magicdomid15" class="ace-line"><span class="author-a-z66zz79zrl2yz75zz66zz83ziz67zhz70zz84zsa b"><b></b></span></div>
    """

(and just paste it back)!
"""



[!!*] ALIKE— clipboard "noiser" in python

https://github.com/Floor-VDB/new-noise



[!!!**] [RAW] 20220303 DOES NOT WORK


    (A) BEFORE set_properlly

dcht00@chetvertyy:/x_hyperpaste$ xclip -selection clipboard -o -t TARGETS
TIMESTAMP
TARGETS
MULTIPLE
SAVE_TARGETS
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain


_____________________________________

 _ _ _ _  TIMESTAMP
b'\x95iQ\x07\x00\x00\x00\x00'


 _ _ _ _  TARGETS
b'\x86\x00\x00\x00\x00\x00\x00\x00\x82\x00\x00\x00\x00\x00\x00\x00\x85\x00\x00\x00\x00\x00\x00\x00\x87\x00\x00\x00\x00\x00\x00\x00\x89\x00\x00\x00\x00\x00\x00\x00\x8a\x00\x00\x00\x00\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00\x8b\x00\x00\x00\x00\x00\x00\x00\x8c\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x8d\x00\x00\x00\x00\x00\x00\x00\x8e\x00\x00\x00\x00\x00\x00\x00'


 _ _ _ _  MULTIPLE


 _ _ _ _  SAVE_TARGETS
b''


 _ _ _ _  GTK_TEXT_BUFFER_CONTENTS
b'`V$\xb0\x86U\x00\x00'


 _ _ _ _  application/x-gtk-text-buffer-rich-text
b'GTKTEXTBUFFERCONTENTS-0001\x00\x00\x00\xeb <text_view_markup>\n <tags>\n  <tag name="gtksourceview:context-classes:no-spell-check" priority="18">\n  </tag>\n </tags>\n<text><apply_tag name="gtksourceview:context-classes:no-spell-check">aaaaa\n</apply_tag></text>\n</text_view_markup>\n'


 _ _ _ _  UTF8_STRING
b'aaaaa\n'


 _ _ _ _  COMPOUND_TEXT
b'aaaaa\n'


 _ _ _ _  TEXT
b'aaaaa\n'


 _ _ _ _  STRING
b'aaaaa\n'


 _ _ _ _  text/plain;charset=utf-8
b'aaaaa\r\n'


 _ _ _ _  text/plain
b'aaaaa\r\n'




    (B) AFTER set_properly

dcht00@chetvertyy:/x_hyperpaste$ xclip -selection clipboard -o -t TARGETS
text/plain;charset=utf-8
UTF8_STRING
TARGETS
TIMESTAMP


/////////////////////////////

 _ _ _ _  TIMESTAMP
b'\xce\x92Q\x07\x00\x00\x00\x00'


 _ _ _ _  TARGETS
b'\x86\x00\x00\x00\x00\x00\x00\x00\x82\x00\x00\x00\x00\x00\x00\x00\x85\x00\x00\x00\x00\x00\x00\x00\x87\x00\x00\x00\x00\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00\x8b\x00\x00\x00\x00\x00\x00\x00\x8c\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x8d\x00\x00\x00\x00\x00\x00\x00\x8e\x00\x00\x00\x00\x00\x00\x00'


 _ _ _ _  MULTIPLE


 _ _ _ _  SAVE_TARGETS
b''


 _ _ _ _  UTF8_STRING
b'yyyyyyyyyyyyyyyy'


 _ _ _ _  COMPOUND_TEXT
b'yyyyyyyyyyyyyyyy'


 _ _ _ _  TEXT
b'yyyyyyyyyyyyyyyy'


 _ _ _ _  STRING
b'yyyyyyyyyyyyyyyy'


 _ _ _ _  text/plain;charset=utf-8
b'yyyyyyyyyyyyyyyy'


 _ _ _ _  text/plain
b'yyyyyyyyyyyyyyyy'


    → CONCLUSIONS [!!!**]

IT IS STILL PASTING THE OLD STRING THOUGH!

MEANS → SO IT IS SOME OTHER FUCKING BUFFER (than what we are displaying in "AFTER"),
    WE ARE EVEN READING FROM WRONG ONE



[!→→] PROJECT— The old "copy buffer" hack idea

Idea @ Berlin 2019  [M!]

https://www.euromoney.com/article/29sh7rxz38y3j2kd7vmrk/treasury/chinas-cips-trapped-in-swifts-shadow
This has the javascript for it
(it replaces your copy buffer!)


————————————— via "dev-xclip" ——————————

$ xclip -o -t TARGETS
a list of targets, you can then use as -t !


[!*] pasting images is possible in twitter !:
    via "copy image"
    wow, how do they do that?


[!→] cycling windows with "wmctrl"

(could be used to wake up lazy firefox loading of "firefox window inserts"...)
https://stackoverflow.com/questions/15172735/cycle-through-windows-of-the-same-application-using-wmcrtl



(MOCK EARLY CODE, from "dev-xclip")

import glib, gtk

def test_clipboard():
    clipboard = gtk.Clipboard()
    targets = clipboard.wait_for_targets()

    print
    print
    print("________________________")
    print "Targets available:"
    print

    print "_______________________________________________________________"
    print "Hmm ", " ......... ".join(map(str, targets))


    """
        for x in targets:
            print x
        print
    """
    for target in targets:
        print
        print("@" + str(target))
        print("__________________")
        contents = clipboard.wait_for_contents(target)
        if contents:
            print contents.data
        print("________________________")
        print

def main():
    mainloop = glib.MainLoop()
    def cb():
        test_clipboard()
        mainloop.quit()
    glib.idle_add(cb)
    mainloop.run()

if __name__ == "__main__":
    main()
____________________________________________________________________________________________________



CASE— (zima/yuan statut does NOT copy well)

https://e-ucenje.ff.uni-lj.si/mod/resource/view.php?id=338978



<------------------------------- ((new))