<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>terminal &#8211; Luxing Huang</title>
	<atom:link href="https://luxing.im/tag/terminal/feed/" rel="self" type="application/rss+xml" />
	<link>https://luxing.im</link>
	<description>Thoughs and things</description>
	<lastBuildDate>Sun, 04 Jun 2023 06:41:48 +0000</lastBuildDate>
	<language>en-CA</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
<site xmlns="com-wordpress:feed-additions:1">58771605</site>	<item>
		<title>mutt integration with Gmail using OAuth</title>
		<link>https://luxing.im/mutt-integration-with-gmail-using-oauth/</link>
					<comments>https://luxing.im/mutt-integration-with-gmail-using-oauth/#comments</comments>
		
		<dc:creator><![CDATA[Luxing Huang]]></dc:creator>
		<pubDate>Tue, 30 Jul 2019 15:15:41 +0000</pubDate>
				<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[terminal]]></category>
		<guid isPermaLink="false">https://luxing.im/?p=813</guid>

					<description><![CDATA[As I mentioned before, I am a heavy terminal user, including viewing and replying emails with it. Mutt is my email client. Once you have setup your 2 factor authentication with Google, you won&#8217;t be able to access your Gmail using IMAP with your password, you&#8217;ll have to generate a specific password for the so &#8230; <p class="link-more"><a href="https://luxing.im/mutt-integration-with-gmail-using-oauth/" class="more-link">Continue reading<span class="screen-reader-text"> "mutt integration with Gmail using OAuth"</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>As I <a href="https://luxing.im/using-mutt-as-email-client/">mentioned</a> before, I am a heavy terminal user, including viewing and replying emails with it. Mutt is my email client. Once you have setup your 2 factor authentication with Google, you won&#8217;t be able to access your Gmail using IMAP with your password, you&#8217;ll have to generate a specific password for the so called <a href="https://support.google.com/a/answer/6260879">&#8220;Less Secure Apps&#8221;</a>. There is a problem with that, if you use IMAP with less-secure-app password on your company account where &#8220;less secure app&#8221; is not allowed, you are probably stuck.</p>
<p>In this tutorial, I am going to show you how to setup the Google recommended OAuth 2.0 way with Mutt.</p>
<p><span id="more-813"></span></p>
<p>Remember, the OAuth client setup should be an one-time step, it should be usable for your different email addresses on Gmail, that includes your work email if your employer choose Gmail as their email service provider, as long as you authorize permission during the OAuth App.</p>
<ol>
<li>Login to your google account, navigate to https://console.cloud.google.com/apis/credentials and if this page says anything API not enabled, enable it.</li>
<li>In the credentials page, create a project.</li>
<li>After creating the project, you should be able to go to the OAuth consent screen tab, put something recognizable in the application name, click save.</li>
<li>Go back to &#8220;Credentials&#8221; page and click on &#8220;Create credentials&#8221; button and select OAuth client ID.</li>
<li>Select other and click create. You&#8217;ll be given an OAuth client ID and secret. You can view the id and secret anytime.</li>
</ol>
<p>Now you&#8217;ve setup an OAuth client, it is time for mutt configuration.</p>
<p>Download oauth2.py from GitLab: <a href="https://gitlab.com/muttmua/mutt/-/blob/master/contrib/mutt_oauth2.py" rel="noopener noreferrer" target="_blank">https://gitlab.com/muttmua/mutt/-/blob/master/contrib/mutt_oauth2.py</a> and make it executable. You&#8217;ll need to run the command to generate an OAuth token.</p>
<p>Fill your Google App client id and secret here: <a href="https://gitlab.com/muttmua/mutt/-/blob/5347d1c5c0f529ad7e1464ce9f1716d54ed9c31a/contrib/mutt_oauth2.py#L61" rel="noopener" target="_blank">https://gitlab.com/muttmua/mutt/-/blob/5347d1c5c0f529ad7e1464ce9f1716d54ed9c31a/contrib/mutt_oauth2.py#L61</a> and Line 62.</p>
<p>Execute the following command to authorize yourself.</p>
<pre>
mutt_oauth2.py userid@myschool.edu.tokens --verbose --authorize
</pre>
<p>Open the web browser with the link given and authenticate yourself, login and grant permission.</p>
<p>The way I manage my files under <code>~/.mutt</code>:</p>
<pre>
.
|-- accounts
|   |-- gmail.asc
|   |-- account2.asc
|   |-- account3.asc
|-- mailcap
|-- muttrc
|-- oauth2.py
...
</pre>
<p>The muttrc master config file only manage generic stuff such as header and format stuff, it also has some macro to map function keys to switch accounts. The actual accounts are under <code>~/.mutt/accounts</code> folder with GPG encryption in ASCII.</p>
<p>The original gmail file should only contain account related stuff, such as IMAP and SMTP configuration. At the core the login lines should be:</p>
<pre>
set imap_user = "your@gmail.com" 
set imap_authenticators="oauthbearer"
set imap_oauth_refresh_command="~/.mutt/mutt_oauth2.py ~/.mutt/tokens/gmail"
set smtp_authenticators="oauthbearer"
set smtp_oauth_refresh_command="~/.mutt/mutt_oauth2.py ~/.mutt/tokens/gmail"
set smtp_url = "smtp://your@gmail.com@smtp.gmail.com:587/"
set from = "your@gmail.com" 
set realname = "Your Name"
set signature = "~/.mutt/signatures/mysig"

# Basic config, you can leave this as is 
set folder = "imaps://imap.gmail.com"
set spoolfile = "+INBOX"
set imap_check_subscribed 
set postponed = "+[Gmail]/Draft"
set record = ""
set header_cache=~/.mutt/cache/headers
</pre>
<p>You should be able to use mutt to view/send emails via Gmail using OAuth 2.0!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://luxing.im/mutt-integration-with-gmail-using-oauth/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">813</post-id>	</item>
		<item>
		<title>Fix Music on Console TiMidity startup error</title>
		<link>https://luxing.im/fix-music-on-console-timidity-startup-error/</link>
					<comments>https://luxing.im/fix-music-on-console-timidity-startup-error/#respond</comments>
		
		<dc:creator><![CDATA[Luxing Huang]]></dc:creator>
		<pubDate>Mon, 19 Feb 2018 16:04:22 +0000</pubDate>
				<category><![CDATA[Learning Notes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[moc]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[terminal]]></category>
		<guid isPermaLink="false">https://luxing.im/?p=749</guid>

					<description><![CDATA[I love to use terminal / console, figured that it is more efficient at most of the times, even when I was listening to music. Music On Console (MOC) is one of the programs that I use. My primary OS is Fedora and right now I am using Fedora 27. Strangely I failed to start &#8230; <p class="link-more"><a href="https://luxing.im/fix-music-on-console-timidity-startup-error/" class="more-link">Continue reading<span class="screen-reader-text"> "Fix Music on Console TiMidity startup error"</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>I love to use terminal / console, figured that it is more efficient at most of the times, even when I was listening to music. Music On Console (MOC) is one of the programs that I use.<br />
<span id="more-749"></span></p>
<p>My primary OS is Fedora and right now I am using Fedora 27.</p>
<p>Strangely I failed to start <code>mocp</code> command once I installed moc, with a little searching, add <code>~/.moc/config</code> file with the content:</p>
<pre>TiMidity_Config = /etc/timidity.cfg</pre>
<p>Make sure this config file has 600 permission or it will complain about insecure permission.</p>
<p>Then I would be able to use mocp in any directory.</p>
<p>MOC has Equalizer support, <a href="http://ftp.daper.net/pub/soft/moc/contrib/eqsets.tar.gz">download</a> the eqset from their official website and the presets to <code>~/.moc/eqsets</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://luxing.im/fix-music-on-console-timidity-startup-error/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">749</post-id>	</item>
		<item>
		<title>Tmux configuration</title>
		<link>https://luxing.im/tmux-configuration/</link>
					<comments>https://luxing.im/tmux-configuration/#respond</comments>
		
		<dc:creator><![CDATA[Luxing Huang]]></dc:creator>
		<pubDate>Fri, 30 Jan 2015 13:16:31 +0000</pubDate>
				<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tmux]]></category>
		<guid isPermaLink="false">https://luxing.im/?p=457</guid>

					<description><![CDATA[Tmux is a terminal multiplexer, the main feature of it for me is to split window side by side, one for doing debugging, the other for coding. I know there are some substitutions available, such as konsole and terminator but I find tmux handy. I&#8217;ve customed some configuration that happens to be useful for me. &#8230; <p class="link-more"><a href="https://luxing.im/tmux-configuration/" class="more-link">Continue reading<span class="screen-reader-text"> "Tmux configuration"</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Tmux is a terminal multiplexer, the main feature of it for me is to split window side by side, one for doing debugging, the other for coding. I know there are some substitutions available, such as konsole and terminator but I find tmux handy.</p>
<p><span id="more-457"></span></p>
<p>I&#8217;ve customed some configuration that happens to be useful for me. I will add comments about them below it.</p>
<pre>
unbind C-b
set -g prefix C-w
</pre>
<p>I have removed the default Ctrl+b key binding and made it to ctrl+w.</p>
<pre>
set -g default-terminal "screen-256color"
set -g status-utf8 on
set-option -g default-shell /bin/zsh
</pre>
<p>Charset and terminal colour setting.</p>
<pre>
#up
bind-key k select-pane -U
#down
bind-key j select-pane -D
#left
bind-key h select-pane -L
#right
bind-key l select-pane -R
</pre>
<p>With these settings done, when switching window, all I should do is ctrl+w+[kjhl]. Vim user, sound familiar?</p>
<p>Of course I&#8217;ve already set the vim keys to ctrl+[kjhl] so it&#8217;s not &#8220;conflicted&#8221; with the tmux key combination.</p>
<pre>
setw -g mode-keys vi
</pre>
<p>Enable vim mode.</p>
<pre>
bind '"' split-window -c "#{pane_current_path}"
bind '%' split-window -h -c "#{pane_current_path}"
</pre>
<p>When split window, create a shell session under the folder of the split session.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://luxing.im/tmux-configuration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">457</post-id>	</item>
		<item>
		<title>ASCII Quarium</title>
		<link>https://luxing.im/ascii-quarium/</link>
					<comments>https://luxing.im/ascii-quarium/#respond</comments>
		
		<dc:creator><![CDATA[Luxing Huang]]></dc:creator>
		<pubDate>Thu, 10 Apr 2014 14:16:22 +0000</pubDate>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[terminal]]></category>
		<guid isPermaLink="false">http://blog.luxing.im/?p=347</guid>

					<description><![CDATA[Make the console a fun place while idle! This is a perl script made by RoboBunny. For RedHat systems: yum install perl-ExtUtils-MakeMaker perl-Term-Animation -y The above 2 packages are dependencies for this animation in terminal. Then download ASCIIquarium from http://robobunny.com/projects/asciiquarium/asciiquarium.tar.gz Decompress this tar and give it an executable permission (+x). Copy it over to any &#8230; <p class="link-more"><a href="https://luxing.im/ascii-quarium/" class="more-link">Continue reading<span class="screen-reader-text"> "ASCII Quarium"</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Make the console a fun place while idle! This is a perl script made by <a href="http://robobunny.com/projects/asciiquarium/html/" target="_blank">RoboBunny</a>.<br />
<span id="more-347"></span><br />
For RedHat systems:</p>
<pre>yum install perl-ExtUtils-MakeMaker perl-Term-Animation -y </pre>
<p>The above 2 packages are dependencies for this animation in terminal.</p>
<p>Then download ASCIIquarium from <a href="http://robobunny.com/projects/asciiquarium/asciiquarium.tar.gz">http://robobunny.com/projects/asciiquarium/asciiquarium.tar.gz</a></p>
<p>Decompress this tar and give it an executable permission (+x).</p>
<p>Copy it over to any location in your $PATH, in my case, I copied to ~/bin</p>
<p>Show the ASCIIquarium by typing <em>asciiquarium</em></p>
<p><img fetchpriority="high" decoding="async" src="http://robobunny.com/projects/asciiquarium/screenshot.png" width="613" height="452" class="alignnone" /></p>
<p>You can quit the animation by pressing &#8220;q&#8221;.</p>
<p>Another similar cool terminal animation is <a href="http://pkgs.org/search/?query=cmatrix&#038;type=smart" target="_blank">cmatrix</a>, give it a go <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://luxing.im/ascii-quarium/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">347</post-id>	</item>
	</channel>
</rss>
