Skip to content

Instantly share code, notes, and snippets.

View joanmarcriera's full-sized avatar
🌴
On vacation

Joan Marc Riera Duocastella joanmarcriera

🌴
On vacation
View GitHub Profile
@joanmarcriera
joanmarcriera / gist:646cc60c48f78da2871ee67d13ebe6ba
Last active April 3, 2026 21:08
pbcopy from remote server
#./bashrc.d/marc_pbcopy.rc
function pbcopy_remote() {
if [ -t 0 ]; then
buf=$(cat "$@")
else
buf=$(cat)
fi
printf '\e]52;c;%s\a' "$(printf '%s' "$buf" | base64 | tr -d '\n')"
@joanmarcriera
joanmarcriera / gist:1027d8fdf5802518149c8144b758443c
Created September 18, 2024 13:20
Bash git prompt with color
function color_my_prompt {
local __user_and_host="\[\033[01;32m\]\u@\h"
local __cur_location="\[\033[01;34m\]\w"
local __git_branch_color="\[\033[31m\]"
#local __git_branch="\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`"
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __prompt_tail="\[\033[35m\]$"
@joanmarcriera
joanmarcriera / tmate_for_ssh.md
Created November 21, 2021 23:16 — forked from iskolbin/tmate_for_ssh.md
Ubuntu(systemd) tmate service for ssh

The motivation is: ssh to remote computer without port forwading, dynamic DNS and so on, the only thing needed is that the remote is connected to the Internet.

  1. On remote get tmate, put it in /usr/local/bin (apt version as of 18.04LTS is too old):
curl -L https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz|tar xJv
sudo mv tmate-2.4.0-static-linux-amd/tmate /usr/local/bin
  1. Put public keys in ~/.ssh/authorized_keys