Skip to content

Instantly share code, notes, and snippets.

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

// Controller section
trait EngineController {
fn forward(&self) -> bool {
return true;
}
}
#[derive(Debug)]
struct Engine {}
flowchart LR
classDef mySubgraphStyle fill:red,stroke:#333,stroke-width:2px,width:200px,height:200px;
classDef actor fill:#f9f,stroke:#333,stroke-width:2px,shape:actor;
subgraph "Main"[Main workflos]
subgraph "WDA"[WorkFlow A]
direction LR
#![no_std]
#![no_main]
use esp_backtrace as _;
use esp_println::println;
use hal::{
clock::ClockControl, peripherals::Peripherals, prelude::*, timer::TimerGroup, Delay, Rtc, IO,
};
#[entry]
fn main() -> ! {

Install espup tool:

cargo install espup
espup install

Init path

source ~/export-esp.sh
#ifndef RAW_INSN_H
#define RAW_INSN_H
#include <linux/bpf.h>
#define BPF_CALL_FUNC(FUNC) \
((struct bpf_insn) { \
.code = BPF_JMP | BPF_CALL | BPF_K, \
.dst_reg = 0, \
.src_reg = 0, \
echo "***************** Certs creation *************************"
function echo {
COLOR="\e[93m";
ENDCOLOR="\e[0m";
printf "$COLOR%b$ENDCOLOR\n" "$1";
}
export CERT_FOLDER="$(pwd)/certs"
export DOMAIN="test.com"
#!/bin/sh
IFS=$'\t'
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
TESTCASES=$(cat <<-END
[
{"path": "XX", "expected": "/XX"},
{"path": "XXX", "expected": "/XXX"},
ARG IMAGE=registry.redhat.io/3scale-amp2/apicast-gateway-rhel8:3scale2.10
FROM ${IMAGE}
USER root
WORKDIR /opt/app-root/src/
RUN dnf install -y perl-App-cpanminus gcc git
ENV LUA_PATH="/usr/lib64/lua/5.1/?.lua;/usr/local/share/lua/5.1/?.lua"
FROM quay.io/centos/centos:centos8.3.2011
RUN dnf install -y rpm-build
RUN dnf install -y annobin-annocheck dos2unix gcc git make pcre-devel
RUN dnf install -y perl perl-File-Temp systemtap-sdt-devel
RUN dnf install -y 'dnf-command(config-manager)'
RUN yum config-manager --add-repo http://packages.dev.3sca.net/dev_packages_3sca_net.repo \
&& sed -i 's/\.net$/.net\/CVE/g' /etc/yum.repos.d/dev_packages_3sca_net.repo
RUN yum install -y openresty-pcre-devel openresty-zlib-devel openssl-devel opentracing-cpp-devel openresty-pcre-devel