Last active
April 26, 2020 12:07
-
-
Save gregoryvit/e6fcb94df1efede9da4aadf5f535e7b0 to your computer and use it in GitHub Desktop.
Revisions
-
gregoryvit revised this gist
Apr 26, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,6 @@ def cb_copy(value): """ Writes data to macOS pastboard """ res = os.system(u'printf "%s" | pbcopy' % value.replace('"', '\\"').replace('%', '%%')) if res != 0: raise(Exception("Exit code: %d" % res)) -
gregoryvit revised this gist
Apr 25, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,6 @@ def cb_copy(value): """ Writes data to macOS pastboard """ res = os.system("printf '%s' | pbcopy" % value) if res != 0: raise(Exception("Exit code: %d" % res)) -
gregoryvit revised this gist
Apr 25, 2020 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,9 @@ def cb_paste(use_bytes=False): stderr=subprocess.PIPE) out, err = p.communicate() if err: raise(Exception(err)) if not use_bytes: return out.decode('utf-8') return out @@ -19,4 +22,6 @@ def cb_copy(value): """ Writes data to macOS pastboard """ res = os.system("printf ''%s' | pbcopy" % value) if res != 0: raise(Exception("Exit code: %d" % res)) -
gregoryvit created this gist
Apr 25, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ import subprocess import os def cb_paste(use_bytes=False): """ Returns the data from macOS pastboard """ p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() if not use_bytes: return out.decode('utf-8') return out def cb_copy(value): """ Writes data to macOS pastboard """ os.system("printf '%s' | pbcopy" % value)