{"id":50804292,"url":"https://github.com/jackdoe/pasta","last_synced_at":"2026-06-12T23:31:59.248Z","repository":{"id":142148095,"uuid":"248862512","full_name":"jackdoe/pasta","owner":"jackdoe","description":"need some tty love","archived":false,"fork":false,"pushed_at":"2020-04-01T10:19:12.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-12T13:15:49.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackdoe.png","metadata":{"files":{"readme":"README.txt","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-20T22:17:55.000Z","updated_at":"2024-06-19T07:48:13.884Z","dependencies_parsed_at":null,"dependency_job_id":"24c74fd2-57a6-4c1e-bece-da40b1fe51e3","html_url":"https://github.com/jackdoe/pasta","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/jackdoe/pasta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fpasta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fpasta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fpasta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fpasta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackdoe","download_url":"https://codeload.github.com/jackdoe/pasta/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fpasta/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34266915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-12T23:31:58.644Z","updated_at":"2026-06-12T23:31:59.242Z","avatar_url":"https://github.com/jackdoe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pasta\n\nservice to share my clipboard in the tty and emacs.\n\nit is an http server that picks random key on start and only stores\nthe latest value in memory.\n\n# install\n\nbuild the cmd/ commands, and copy them to /usr/bin\nthen:\n\n  $ cp pasta-server.service ~/.config/systemd/user\n  $ systemctl enable --user pasta-server\n\nor run install.sh which does those steps\n\n# setup\n\nmake emacs use pasta-paste and pasta-copy:\n\n  (defun copy-from-linux ()\n    (shell-command-to-string \"pasta-paste\"))\n  \n  (defun paste-to-linux (text \u0026optional push)\n    (let ((process-connection-type nil))\n      (let ((proc (start-process \"pasta-copy\" \"*Messages*\" \"pasta-copy\")))\n        (process-send-string proc text)\n        (process-send-eof proc))))\n  \n  (setq interprogram-cut-function 'paste-to-linux)\n  (setq interprogram-paste-function 'copy-from-linux)\n\n\nAlso in zsh:\n  pasta_paste() {\n      p=$(pasta-paste)\n      cp=$LBUFFER$p\n\n      BUFFER=$LBUFFER$p$RBUFFER\n      CURSOR=${#cp}\n  }\n\n  zle -N pasta_paste\n  bindkey \"^y\" pasta_paste\n\n  alias pbcopy=pasta-copy\n  alias pbpaste=pasta-paste\n\nso now i can do `echo -n a | pbcopy` and then in emacs just C-y\n\npretty cool.\n\nPS: it is just a http server you can use it with curl:\n\n  # put aaa in the clipboard\n  echo -n 'aaa' | curl --unix-socket $HOME/.pasta/sock --data-binary @- http://unix/copy\n\n  # get aaa from the clipboard\n  curl --unix-socket $HOME/.pasta/sock  http://unix/paste\n\n\nIf you want to add support for programatically getting the mouse\nselection you have to apply linux-5.6.0-patch/add_copy_selection_to_user.diff\n(dont use in production, it is just a hack to get the current\nselection)\n\nthen you can run `pasta-copy -sel` which will do\n\n\tfd, _ := os.Open(\"/dev/tty\")\n\n\tvalue := make([]byte, 1024*10) // 10k should be enough\n\n\tvalue[0] = byte(TIOCL_GETSEL)\n\tnativeEndian.PutUint32(value[1:], uint32(len(value)-5))\n\n\terr = ioctl(int(fd.Fd()), TIOCLINUX, uintptr(unsafe.Pointer(\u0026value[0])))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsize := nativeEndian.Uint32(value[1:])\n\tclipboard = bytes.NewReader(value[5 : size+5])\n\nand send it to the pasta server\n\npasta_mouse_copy() {\n    pasta-copy -sel\n}\n\nzle -N pasta_mouse_copy\nbindkey \"^[w\" pasta_mouse_copy\n\n\nthe kernel patch looks like:\n\n---\n\nin drivers/tty/vt/selection.c:\n\n+int copy_selection_to_user(char __user *arg)\n+{\n+\tint get_sel_user_size;\n+\tint ret;\n+\n+\tif (copy_from_user(\u0026get_sel_user_size,\n+\t\t\t   arg,\n+\t\t\t   sizeof(sel_buffer_lth)))\n+\t\treturn -EFAULT;\n+\n+\tmutex_lock(\u0026sel_lock);\n+\n+\tif (get_sel_user_size \u003c sel_buffer_lth) {\n+\n+\t\tmutex_unlock(\u0026sel_lock);\n+\n+\t\treturn -EFAULT;\n+\t}\n+\n+\tret = copy_to_user(arg,\n+\t\t\t   \u0026sel_buffer_lth,\n+\t\t\t   sizeof(sel_buffer_lth));\n+\tif (ret == 0)\n+\t\tret = copy_to_user(arg+sizeof(sel_buffer_lth),\n+\t\t\t\t   sel_buffer,\n+\t\t\t\t   sel_buffer_lth);\n+\n+\tmutex_unlock(\u0026sel_lock);\n+\n+\treturn ret;\n+}\n\nand in drivers/tty/vt/vt.c (tioclinux):\n\n+\t\tcase TIOCL_GETSEL:\n+\t\t\tret = copy_selection_to_user(p+1);\n+\t\t\tbreak;\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdoe%2Fpasta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackdoe%2Fpasta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdoe%2Fpasta/lists"}