<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Owen Ou on Medium]]></title>
        <description><![CDATA[Stories by Owen Ou on Medium]]></description>
        <link>https://medium.com/@owenou?source=rss-8ee67dcf37a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VkA5gWSas1HPTG7w.jpg</url>
            <title>Stories by Owen Ou on Medium</title>
            <link>https://medium.com/@owenou?source=rss-8ee67dcf37a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 08:58:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@owenou/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Upterm — Secure Terminal Sharing]]></title>
            <link>https://medium.com/@owenou/upterm-secure-terminal-sharing-1f4add94f5ac?source=rss-8ee67dcf37a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f4add94f5ac</guid>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[tmux]]></category>
            <category><![CDATA[remote-pair-programming]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Owen Ou]]></dc:creator>
            <pubDate>Sat, 11 Jul 2020 00:00:00 GMT</pubDate>
            <atom:updated>2020-07-13T19:25:21.769Z</atom:updated>
            <content:encoded><![CDATA[<h3>Remote Pair Programming With Upterm</h3><p><a href="https://github.com/jingweno/upterm">Upterm</a> is an open-sourced solution for sharing terminal sessions instantly over the public internet via SSH tunnels. It is good for</p><ul><li>Remote pair programming</li><li>Access remote computers behind NATs and firewalls</li><li>Remote debugging</li></ul><p>Upterm is written in Go and is open-sourced at <a href="https://github.com/jingweno/upterm">https://github.com/jingweno/upterm</a>.</p><h3>How it works</h3><p>You run the upterm program by hosting a terminal session. Upterm starts an SSH server on your machine and connects to an Upterm server (a.k.a. uptermd) via reverse SSH tunnel. Your friends connect to your terminal session using ssh via the same Upterm server.</p><p>Here is a diagram on the technical details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMBm-QesdtzgTlJ67qxKvg.png" /></figure><h3>Demo</h3><p><a href="https://asciinema.org/a/LTwpMqvvV98eo3ueZHoifLHf7">Upterm Demo</a></p><h3>Quickstart</h3><p>Install upterm by following <a href="https://github.com/jingweno/upterm#installation">this guide</a>.</p><p>On your machine, host a terminal session by specifying a command:</p><pre>$ upterm host -- bash</pre><p>upterm will start the command and pop up an ssh connection string that one can connect. In case you miss the connection string, display it with:</p><pre>$ upterm session current<br>=== IQKSFOICLSNNXQZTDKOJ<br>Command:                bash<br>Force Command:          n/a<br>Host:                   ssh://uptermd.upterm.dev:22<br>SSH Session:            ssh IqKsfoiclsNnxqztDKoj:MTAuMC40OS4xNjY6MjI=@uptermd.upterm.dev</pre><p>Open a new terminal and connect to the session:</p><pre>$ ssh IqKsfoiclsNnxqztDKoj:MTAuMC40OS4xNjY6MjI=@uptermd.upterm.dev</pre><p>You should see the input and output of both terminals are linked!</p><p>If you want only authorized clients to connect to your session, you can specify the clients’ authorized keys with:</p><pre>$ upterm host --authorized-key PATH_TO_PUBLIC_KEY -- bash</pre><p>If you are looking for a <a href="https://tmate.io/">Tmate</a>-like experience, create a <a href="https://github.com/tmux/tmux">Tmux</a> session, and “force” clients to attach to the Tmux session:</p><pre>$ upterm host --force-command &#39;tmux attach -t pair-programming&#39; -- tmux new -t pair-programming</pre><p>The above creates a Tmux session by running tmux new -t pair-programming. After a client connects, Upterm will attach the client&#39;s input and output to the input and output of the Tmux session &quot;pair-programming&quot;.</p><p>If you are concerned with others accessing your root file system, wrap the terminal session in a Docker container:</p><pre>$ upterm host -- docker run --rm -ti ubuntu bash</pre><p>I will write another blog post in the future to share how I securely host a terminal session using containers.</p><h3>How is Upterm compared to prior arts?</h3><p>Upterm is an alternative to <a href="https://tmate.io/">Tmate</a>.</p><p>Tmate is a fork of an older version of Tmux. It adds terminal sharing capability on top of Tmux 2.x. Tmate doesn’t intend to catch up with the latest Tmux (at this time of the post, the latest Tmux is 3.x), so any Tmate &amp; Tmux users must maintain two versions of the configuration. For example, you must <a href="https://github.com/tmate-io/tmate/issues/108">bind the same keys twice with a condition</a>.</p><p>Upterm is designed from the group up not to be a fork of anything. It builds around the concept of linking the input &amp; output of any shell command between a host and its clients. As you see above, you can share any command besides tmux. This opens up a door for securely sharing a terminal session using containers (I will explain more in a future post).</p><p>Upterm is written in Go. It is more friendly hackable than Tmate that is written in C because Tmux is C. The Upterm CLI and server ( uptermd) are compiled into a single binary. You can quickly <a href="https://github.com/jingweno/upterm#deploy-uptermd">spawn up your pairing server</a> in any cloud environment with zero dependencies.</p><h3>Tips</h3><h4>Why doesn’t upterm show the current terminal session in Tmux?</h4><p>upterm session current shows the connection info of the current terminal session. It needs the UPTERM_ADMIN_SOCKET environment variable to function. By default, Tmux doesn&#39;t carry over environment variables that are not in its <a href="http://man.openbsd.org/i386/tmux.1#GLOBAL_AND_SESSION_ENVIRONMENT">default list</a> to a Tmux session unless you tell it. So add the following line to your~/.tmux.conf:</p><pre>set-option -ga update-environment &quot; UPTERM_ADMIN_SOCKET&quot;</pre><h4>How to make it obvious that I am in an upterm session?</h4><p>It can be confusing whether your terminal session is an upterm session or not. As an example, I add an emoji to my prompt to identify an upterm session:</p><pre># in your ~/.bashrc or ~/.zshrc <br>export PS1=&quot;$([[ ! -z &quot;${UPTERM_ADMIN_SOCKET}&quot;  ]] &amp;&amp; echo -e &#39;\xF0\x9F\x86\x99 &#39;)$PS1&quot; # Add an emoji</pre><p>This is what it looks like :-):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/0*gZMTQY4QiZHBDqsy.png" /></figure><h3>Deploy Uptermd</h3><p>Upterm needs an Upterm server (a.k.a. uptermd) to expose terminal sessions securely. There is a community server running at uptermd.upterm.dev for your convenience (please put it into good use!). However, if you want to host your pairing server on <a href="https://kubernetes.io/">Kubernetes</a> or <a href="https://heroku.com/">Heroku</a>, follow <a href="https://github.com/jingweno/upterm#how-it-works">this deployment guide</a>. You are welcome to contribute one for your favorite cloud platforms. I am pleased to review it if you shoot me a <a href="https://github.com/jingweno/upterm/pulls">PR</a> :-).</p><p>To talk to a different uptermd server other than the community server, you specify with the --server flag:</p><pre># Use your Uptermd server via SSH on TCP<br>$ upterm host --server ssh://YOUR_SERVER -- YOUR_COMMAND<br><br># Use your Uptermd server via SSH on WebSocket<br>$ upterm host --server wss://YOUR_SERVER -- YOUR_COMMAND<br><br># Client connects to the host session via SSH on WebSocket<br>$ ssh -o ProxyCommand=&#39;upterm proxy wss://TOKEN@YOUR_SERVER&#39; TOKEN@YOUR_SERVER:443</pre><h3>Conclusion</h3><p>I am super excited about upterm, and I dogfood it daily to pair program with my coworkers (Disclaimer: I work remotely for Heroku). If you like what you see here, give upterm a shot. I am looking forward to your valuable feedback and contributions: <a href="https://github.com/jingweno/upterm/issues">https://github.com/jingweno/upterm/issues</a> :-).</p><p><em>Originally published at </em><a href="https://owenou.com/upterm/"><em>https://owenou.com</em></a><em> on July 11, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f4add94f5ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upterm — Secure Terminal Sharing]]></title>
            <link>https://medium.com/@owenou/upterm-secure-terminal-sharing-3d02a247ef02?source=rss-8ee67dcf37a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d02a247ef02</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[tunnel]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Owen Ou]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 23:38:35 GMT</pubDate>
            <atom:updated>2020-01-02T23:47:26.938Z</atom:updated>
            <content:encoded><![CDATA[<h3>Upterm — Secure Terminal Sharing</h3><p><a href="https://github.com/jingweno/upterm">Upterm</a> is an open-source solution for sharing terminal sessions instantly with the public internet over secure tunnels.</p><h3>What it’s good for</h3><ul><li>Remote pair programming</li><li>Access remote computers behind NATs and firewalls</li><li>Remote debugging</li><li>&lt;insert your creative use cases&gt;</li></ul><h3>How it works</h3><p>You run the upterm program and specify the command for your terminal session. Upterm starts an SSH server locally and sets up a Reverse SSH tunnel to the <a href="https://github.com/jingweno/upterm/tree/master/cmd/uptermd">Upterm server</a> (a.k.a. uptermd). Clients connect to your terminal session over the public internet with ssh.</p><h3>Installation</h3><h3>Mac</h3><pre>brew tap jingweno/upterm<br>brew install upterm</pre><h3>From source</h3><pre>go get -u github.com/jingweno/upterm/cmd/upterm</pre><h3>Quick Start</h3><pre># Host a terminal session by running $SHELL<br># The client&#39;s input/output is attached to the host&#39;s<br>$ upterm host</pre><pre># Display the ssh connection string<br>$ upterm session current<br>=== BO6NOSSTP9LL08DOQ0RG<br>Command:                /bin/bash<br>Force Command:          n/a<br>Host:                   uptermd.upterm.dev:22<br>SSH Session:            ssh bo6nosstp9ll08doq0rg:MTAuMC4xNzAuMTY0OjIy@uptermd.upterm.dev</pre><pre># Open a new terminal and connect to the session<br>$ ssh bo6nosstp9ll08doq0rg:MTAuMC4xNzAuMTY0OjIy@uptermd.upterm.dev</pre><pre># Host a terminal session by running $SHELL<br># The client&#39;s input/output is attached to the host&#39;s.<br>$ upterm host</pre><pre># Display the ssh connection string<br>$ upterm session current<br>=== BO6NOSSTP9LL08DOQ0RG<br>Command:                /bin/bash<br>Force Command:          n/a<br>Host:                   uptermd.upterm.dev:22<br>SSH Session:            ssh bo6nosstp9ll08doq0rg:MTAuMC4xNzAuMTY0OjIy@uptermd.upterm.dev</pre><pre># Open a new terminal and connect to the session<br>$ ssh bo6nosstp9ll08doq0rg:MTAuMC4xNzAuMTY0OjIy@uptermd.upterm.dev</pre><pre># Host a session with a custom command.<br># The client&#39;s input/output is attached to the host&#39;s.<br>$ upterm host -- docker run --rm -ti ubuntu bash</pre><pre># Host a session by running &#39;tmux new -t pair-programming&#39;.<br># The host runs &#39;tmux attach -t pair-programming&#39; after the client joins the session.<br># The client&#39;s input/output is attached to this command&#39;s.<br>$ upterm host --force-command &#39;tmux attach -t pair-programming&#39; -- tmux new -t pair-programming`,</pre><p>More advanced usage is <a href="https://github.com/jingweno/upterm/blob/master/docs/upterm.md">here</a>.</p><h3>Demo</h3><p><a href="https://asciinema.org/a/AnXTj0pOOtvSWALjUIQ63OKDm">https://asciinema.org/a/AnXTj0pOOtvSWALjUIQ63OKDm</a></p><h3>License</h3><p><a href="https://github.com/jingweno/upterm/blob/master/LICENSE">Apache 2.0</a></p><h3>References</h3><ul><li><a href="https://github.com/jingweno/upterm">https://github.com/jingweno/upterm</a></li><li><a href="https://upterm.dev/">https://upterm.dev</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d02a247ef02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ten Things You Didn’t Know Git And GitHub Could Do]]></title>
            <link>https://medium.com/@owenou/ten-things-you-didn-t-know-git-and-github-could-do-e9d80b55384f?source=rss-8ee67dcf37a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9d80b55384f</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Owen Ou]]></dc:creator>
            <pubDate>Fri, 13 Jan 2012 00:00:00 GMT</pubDate>
            <atom:updated>2016-02-18T15:54:08.751Z</atom:updated>
            <content:encoded><![CDATA[<p>Git and GitHub are powerful tools. Even if you have worked with them for a long time, it’s likely that you haven’t stumbled across everything yet. I collect 10 common tricks for both Git and GitHub that potentially increase your day-to-day productivity.</p><h4>GitHub</h4><p><strong>keyboard shortcut: t &amp; w</strong></p><p>On your source code browsing page, press <strong>t</strong> to enter the fuzzy file finder mode:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*yqZ9-7akeHZf5fjN.png" /></figure><p>On your repository’s home page, press <strong>w</strong> to quickly filter branches:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*c3CCFyBcmB9yH3v6.png" /></figure><p>On any GitHub page, press <strong>?</strong> to show the list of shortcuts applied to a particular page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*h4brsllvC083PS-M.png" /></figure><p><strong>ignoring whitespace: ?w=1</strong></p><p>Add <strong>?w=1</strong> any diff URL to trim whitespace:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*DZmaAvApputfX3zq.png" /></figure><p><strong>commits by range: master@{time}..master</strong></p><p>You can create a compare view in GitHub by using the URL <strong>github.com/user/repo/compare/{range}</strong>. Range can be two SHAs like <strong>sha1…sha2</strong> or two branches’ name like <strong>master…my-branch</strong>. Range is also smart enough to take time into consideration. For example, you can filter a list of commits since yesterday by using format like <strong>master@{1.day.ago}…master</strong>. The link <a href="https://github.com/rails/rails/compare/master@%7B1.day.ago%7D...master">https://github.com/rails/rails/compare/master@{1.day.ago}…master</a>, for example, gets all commits since yesterday for the Rails project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*dS9kQgvjdnRnagMZ.png" /></figure><p>You can filter commits by author in the commit view by appending param <strong>?author=github_handle</strong>. For exmaple, the link <a href="https://github.com/dynjs/dynjs/commits/master?author=jingweno">https://github.com/dynjs/dynjs/commits/master?author=jingweno</a> shows a list of my commits to the <a href="http://dynjs.org/">Dynjs</a> project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*SzCuFbRhdwNFFOQJ.png" /></figure><p><strong>.diff &amp; .patch</strong></p><p>Add <strong>.diff</strong> or <strong>.patch</strong> to the URLs of compare view, pull request or commit page to get the diff or patch in text format. For example, the link <a href="https://github.com/rails/rails/compare/master@%7B1.day.ago%7D...master.patch">https://github.com/rails/rails/compare/master@{1.day.ago}…master.patch</a> gets the patch for all the commits since yesterday in the Rails project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*LLYUtkThdAEpBu1d.png" /></figure><p><strong>email reply</strong></p><p>You can comment directly by replying to the email received from GitHub instead of commenting on the website. GitHub will route your reply correctly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*rh8VQjSiBhY9RCbQ.png" /></figure><p>In any file view, when you click one line or multiple lines by pressing <strong>SHIFT</strong>, the URL will change to reflect your selections. This is very handy for sharing the link to a chunk of code with your teammates:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*MiazDjPTrUvStu1B.png" /></figure><p>Mentioning users in pull requests, issues or any comment will subscribe them to all subsequent notifications:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*EmRN2rVayuNYv-cw.png" /></figure><p>In pull requests, issues or any comment, sha and issue number (#1 for example) will be automatically linked. Besides, you can link sha or issue number from another repository with the format of <strong>user/repo@sha1</strong> or <strong>user/repo#1</strong> respectively. The following is an example of autolinking a sha in a comment:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*yQ5wUoXzzKCCSo0J.png" /></figure><p><strong>hub</strong></p><p><a href="https://github.com/defunkt/hub">Hub</a> is the command line GitHub. It provides integration between Git and GitHub in command line. One of the most useful commands is creating pull request by just typing “<strong>hub pull-request</strong>” in your terminal. Detail of all other commands is available on its project <a href="https://github.com/defunkt/hub#commands">readme</a>.</p><h4>Git</h4><p><strong>git log -p FILE</strong></p><p>To view changes in history for README.md, for example, type</p><p>&gt; git log -p README.md</p><p><strong>git log -S ‘PATTERN’</strong></p><p>To search for changes that matches the pattern “stupid” in history, for example, type</p><p>&gt; git log -S ‘stupid’</p><p>Combining with “-p” shows the changes with the search pattern.</p><p><strong>git add -p</strong></p><p>To interactively stage and unstage changes, type</p><p>&gt; git add -p</p><p>Updated 2013–01–18: From <a href="https://twitter.com/tjwallace">@tjwallace</a>, git checkout and git reset also support the –patch (-p) option for the interactive mode.</p><p>Updated 2013–03–17: From <a href="http://owenou.com/2012/01/13/ten-things-you-didnt-know-git-and-github-could-do.html#comment-832473162">jasherai</a>, git stash also supports the –patch (-p) option.</p><p><strong>git rm –cached FILE</strong></p><p>This command removes remote file copy only. For example, typing</p><p>&gt; git rm — cached database.yml</p><p>removes database.yml that is already checked in but leaving the local copy untouched. This is intensively handy for removing ignored files that are already pushed without removing the local copies.</p><p><strong>git log ..BRANCH</strong></p><p>This command returns all the commits in a branch that are not in HEAD. For example, assuming you are on a feature branch, typing</p><p>&gt; git log ..master</p><p>gets all commits that are in master but not merged into the current feature branch yet.</p><p><strong>git branch –merged &amp; git branch –no-merged</strong></p><p>This command returns a list of branches that are merged or not yet merged to current branch. It’s a useful check before any merging happens. For example, on a featrue branch, typing</p><p>&gt; git branch — no-merged</p><p>returns a list of branchs that are not yet merged to the feature branch.</p><p><strong>git branch –contains SHA</strong></p><p>This returns which branch contains a specified sha key, for example, typing</p><p>&gt; git branch — contains 2f8e2b</p><p>shows all branches containing the commit 2f832b. It is very helpful for verifying whether a git cherry-pick is done correctly for instance.</p><p><strong>git status -s</strong></p><p>It returns a less verbose version of git status. I setup this command as my default when running git status to reduce noise.</p><p><strong>git reflog</strong></p><p>It shows a list of operations you have done to your local git repository. It’s very helpful for restoring lost commits for example since it returns the complete history of all git operations with commit SHAs.</p><p><strong>git shortlog -sn</strong></p><p>This shows a list of contributors ordered by number of commits. Similar to the contributors view of GitHub.</p><p>Git is a well engineered tool. Understanding it will definitely make you a more productive and capable programmer. GitHub, on the other hand, provides handy team collaboration features on top of Git. Being able to use GitHub well also increases your day-to-day efficiency.</p><p>To further deepen your Git and GitHub skills, I recommend the following materials:</p><ul><li><a href="http://git-scm.com/book">ProGit</a>, the best book on Git</li><li><a href="https://peepcode.com/products/advanced-git">Advanced Git</a> serials by <a href="https://peepcode.com/">Peepcode</a></li><li><a href="http://zachholman.com/talk/git-github-secrets/">Git and GitHub Secrets</a> talk by <a href="https://twitter.com/holman">Zach Holman</a></li></ul><p><em>Originally published at </em><a href="https://owenou.com/2012/01/13/ten-things-you-didnt-know-git-and-github-could-do"><em>owenou.com</em></a><em> on January 13, 2012.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9d80b55384f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>