mirror of
https://github.com/balkian/balkian.github.com.git
synced 2024-12-27 02:38:13 +00:00
254 lines
16 KiB
HTML
254 lines
16 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
|
<title>Balkian's site - WELCOME</title>
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../../font-awesome/css/all.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" media="only screen" href="../../css/main.css">
|
||
|
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300|Comfortaa' rel='stylesheet' type='text/css'>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="container" class="container">
|
||
|
<div id="contentwrapper">
|
||
|
<div id="content">
|
||
|
<header id="header">
|
||
|
<ul class="navbar" id="navbar">
|
||
|
<a href="../../">
|
||
|
<li >
|
||
|
<i class="fa fa-home fa-large"></i>
|
||
|
</li></a>
|
||
|
|
||
|
|
||
|
<a href="../../post/"><li class='' >Blog
|
||
|
</li></a>
|
||
|
|
||
|
<a href="../../tags/"><li class='' >Tags
|
||
|
</li></a>
|
||
|
|
||
|
<a href="../../cheatsheet/"><li class='' >Cheatsheets
|
||
|
</li></a>
|
||
|
|
||
|
<a href="../../project/"><li class='' >Projects
|
||
|
</li></a>
|
||
|
|
||
|
<a href="../../page/todo/"><li class='' >To-do
|
||
|
</li></a>
|
||
|
|
||
|
<a href="//jfernando.es" target="_blank"><li>
|
||
|
CV
|
||
|
</li></a>
|
||
|
<a href="../../search"><li>
|
||
|
<i class="fa fa-search"></i>
|
||
|
</li></a>
|
||
|
</ul>
|
||
|
</header>
|
||
|
|
||
|
|
||
|
<h2>Linux</h2>
|
||
|
|
||
|
<h1 id="black-screen-and-lightdm-doesnt-unlock">Black screen and LightDM doesn’t unlock</h1>
|
||
|
<p>Add this to your /etc/lightdm/lightdm.conf file:</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-cfg" data-lang="cfg"><span style="color:#66d9ef">[LightDM]</span>
|
||
|
<span style="color:#a6e22e">logind-check-graphical</span><span style="color:#f92672">=</span><span style="color:#e6db74">true</span>
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><h1 id="edit-previous-commands">Edit previous commands</h1>
|
||
|
<p><code>fc</code> is a shell builtin to list and edit previous commands in an editor.
|
||
|
In addition to editing a single line (which you can also do with <code>C-x C-e</code>), it also allows you to edit and run several lines at the same time.
|
||
|
You use it like this:</p>
|
||
|
<p>List previous commands</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ fc -l
|
||
|
<span style="color:#ae81ff">10259</span> nvim deploy.sh
|
||
|
10260* cd ..
|
||
|
10261* nvim content/cheatsheet/linux.md
|
||
|
<span style="color:#ae81ff">10262</span> cd
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>List commands with date (in zsh)</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ fc -ld
|
||
|
10260* 19:38 cd ..
|
||
|
10261* 19:38 nvim content/cheatsheet/linux.md
|
||
|
<span style="color:#ae81ff">10262</span> 19:40 cd
|
||
|
<span style="color:#ae81ff">10263</span> 19:40 fc -l
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>You can add the date too:</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ fc -fld
|
||
|
<span style="color:#ae81ff">10262</span> 1/10/2019 19:40 cd
|
||
|
<span style="color:#ae81ff">10263</span> 1/10/2019 19:40 fc -l
|
||
|
<span style="color:#ae81ff">10264</span> 1/10/2019 19:40 fc -ld
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>You can edit a range of commands</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ fc <span style="color:#ae81ff">10262</span> <span style="color:#ae81ff">10264</span>
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>The range can be relative to the current position, so the previous command is equivalent to:</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ fc -3 -1
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>If you save and exit, all commands are executed as a script, and it will be added to your history.</p>
|
||
|
<p>Source: <a href="https://shapeshed.com/unix-fc/">https://shapeshed.com/unix-fc/</a></p>
|
||
|
<h1 id="prevent-logoff-from-killing-tmux-sessions">Prevent logoff from killing tmux sessions</h1>
|
||
|
<p>Lately I’ve noticed that logging out of i3, intentionally or when i3 fails, would also kill any tmux or emacs sessions.
|
||
|
This is extremely annoying.</p>
|
||
|
<p>This is caused by a new default in logind (systemd’s login) to kill user process on logoff.
|
||
|
You can revert this setting in your logind.conf (<code>/etc/systemd/logind.conf</code>):</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-cfg" data-lang="cfg"><span style="color:#a6e22e">KillUserProcesses</span><span style="color:#f92672">=</span><span style="color:#e6db74">no</span>
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>Or only for a specific process (e.g., tmux):</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">systemd-run --scope --user tmux
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>Source: <a href="https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session">https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session</a></p>
|
||
|
<h1 id="upload-a-temporary-file">Upload a temporary file</h1>
|
||
|
<p>Sometimes you just need to copy/paste a file from a server, and copying from the terminal can be a hassle.
|
||
|
These two services are command-line “pastebins” just one curl away:</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">8
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><command> | curl -F <span style="color:#e6db74">'sprunge=<-'</span> http://sprunge.us
|
||
|
<span style="color:#75715e"># OR</span>
|
||
|
|
||
|
<command> 2>&<span style="color:#ae81ff">1</span> | curl -F <span style="color:#e6db74">'f:1=<-'</span> ix.io
|
||
|
|
||
|
<span style="color:#75715e"># OR</span>
|
||
|
|
||
|
<command> | curl -F<span style="color:#e6db74">"file=@-"</span> https://ttm.sh
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><h1 id="install-fortinet-sslvpn-support-for-networkmanager">Install Fortinet SSLVPN support for NetworkManager</h1>
|
||
|
<p>UPM (Universidad Politécnica de Madrid) uses a propriatary VPN solution.
|
||
|
The instructions for GNU/Linux on their website involve downloading a specific client (<code>.tar.gz</code>) and manually running it.
|
||
|
That works, but it is kind of a hassle.
|
||
|
A much more convenient alternative is installing this NetworkManager plugin:</p>
|
||
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
|
||
|
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
|
||
|
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
|
||
|
</span></code></pre></td>
|
||
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
||
|
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">pacman -Sy networkmanager-fortisslvpn
|
||
|
<span style="color:#75715e"># Or apt get install networkmanager-fortisslvpn</span>
|
||
|
</code></pre></td></tr></table>
|
||
|
</div>
|
||
|
</div><p>Now you can simply add a new VPN connection in NetworkManager and manage it as you would any other connection.</p>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div id="sidebar" class="fixed">
|
||
|
<div class="toc">
|
||
|
<h3>Contents:</h3>
|
||
|
<nav id="TableOfContents">
|
||
|
<ul>
|
||
|
<li><a href="#black-screen-and-lightdm-doesnt-unlock">Black screen and LightDM doesn’t unlock</a></li>
|
||
|
<li><a href="#edit-previous-commands">Edit previous commands</a></li>
|
||
|
<li><a href="#prevent-logoff-from-killing-tmux-sessions">Prevent logoff from killing tmux sessions</a></li>
|
||
|
<li><a href="#upload-a-temporary-file">Upload a temporary file</a></li>
|
||
|
<li><a href="#install-fortinet-sslvpn-support-for-networkmanager">Install Fortinet SSLVPN support for NetworkManager</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="clear"></div>
|
||
|
</div>
|
||
|
<footer class="pagefooter" role="contentinfo">
|
||
|
<div class="contact">
|
||
|
<p>
|
||
|
J. Fernando Sánchez Rada | balkian
|
||
|
</p>
|
||
|
</div>
|
||
|
<ul id="social">
|
||
|
<li><a href="http://github.com/balkian"><i class="fab fa-github"></i></a></li>
|
||
|
<li><a href="http://lab.gsi.upm.es/balkian"><i class="fab fa-gitlab"></i></a></li>
|
||
|
<li><a href="http://twitter.com/balkian"><i class="fab fa-twitter"></i></a></li>
|
||
|
<li><a href="http://git.sinpapel.es/balkian"><i class="fab fa-git"></i></a></li>
|
||
|
<li><a href="http://linkedin.com/in/jfsanchezrada"><i class="fab fa-linkedin"></i></a></li>
|
||
|
</ul>
|
||
|
<p>
|
||
|
<i class="fab fa-creative-commons"></i> Creative Commons A-SA-NC
|
||
|
</p>
|
||
|
</footer>
|
||
|
</div>
|
||
|
|
||
|
<script src="../../js/jquery-2.0.2.min.js"></script>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|