<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="https://www.bigdick.live/feed_style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
        <tabi:base_url>https:&#x2F;&#x2F;www.bigdick.live</tabi:base_url>
        <tabi:separator>
            •
        </tabi:separator>
        <tabi:about_feeds>This is a web feed, also known as an Atom feed. Subscribe by copying the URL from the address bar into your newsreader. Visit About Feeds to learn more and get started. It&#x27;s free.</tabi:about_feeds>
        <tabi:visit_the_site>Visit website</tabi:visit_the_site>
        <tabi:recent_posts>Recent posts</tabi:recent_posts>
        <tabi:last_updated_on>Updated on $DATE</tabi:last_updated_on>
        <tabi:default_theme></tabi:default_theme>
        <tabi:post_listing_date>date</tabi:post_listing_date>
        <tabi:current_section>Yu Sun</tabi:current_section>
    </tabi:metadata><link rel="extra-stylesheet" href="https://www.bigdick.live/skins/black-orange.css?h=c64b7f81e34a143cd725" /><title>Yu Sun</title>
        <subtitle>Yu Sun&#x27;s personal site for bioinformatics, data science, software engineering, public resume, projects, and posts.</subtitle>
    <link href="https://www.bigdick.live/en/atom.xml" rel="self" type="application/atom+xml"/>
    <link href="https://www.bigdick.live/en/" rel="alternate" type="text/html"/>
    <generator uri="https://www.getzola.org/">Zola</generator><updated>2017-06-19T00:00:00+00:00</updated><id>https://www.bigdick.live/en/atom.xml</id><entry xml:lang="en">
        <title>How to maintain an AUR package</title>
        <published>2017-06-19T00:00:00+00:00</published>
        <updated>2017-06-19T00:00:00+00:00</updated>
        <author>
            <name>Yu Sun</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/en/blog/maintaining-aur-packages/" type="text/html"/>
        <id>https://www.bigdick.live/en/blog/maintaining-aur-packages/</id>
        
            <content type="html">&lt;h2 id=&quot;generating-an-ssh-key-pair&quot;&gt;Generating an SSH key pair&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;ssh-keygen&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-punctuation z-definition z-string&quot;&gt; -t ecdsa -C &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;whoami&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;hostname&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -I&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;During the process, it’s highly recommended to specify a file name for this ssh key,
for you may have more keys (for &lt;em&gt;GitHub&lt;&#x2F;em&gt;, etc) in the future. Also you should remember the passphrase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;authentication&quot;&gt;Authentication&lt;&#x2F;h2&gt;
&lt;p&gt;Suppose my key pair is named as &lt;code&gt;aur_ecdsa&lt;&#x2F;code&gt; and &lt;code&gt;aur_ecdsa.pub&lt;&#x2F;code&gt;.
Go to the &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;aur.archlinux.org&quot;&gt;index page&lt;&#x2F;a&gt; of &lt;em&gt;AUR&lt;&#x2F;em&gt; and choose “My account”,
then enter the content of &lt;code&gt;aur_ecdsa.pub&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Edit the configuration file: &lt;code&gt;vim ~&#x2F;.ssh&#x2F;config&lt;&#x2F;code&gt;, then add lines below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host aur.archlinux.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  IdentityFile ~&#x2F;.ssh&#x2F;aur_ecdsa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  User aur&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;The value of the &lt;code&gt;User&lt;&#x2F;code&gt; should always be &lt;code&gt;aur&lt;&#x2F;code&gt; but not others.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Save it!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;modify-the-package&quot;&gt;Modify the package&lt;&#x2F;h2&gt;
&lt;p&gt;In order to maintaining the &lt;em&gt;Git&lt;&#x2F;em&gt; repository for an existing package,
simply &lt;code&gt;git clone&lt;&#x2F;code&gt; the remote repository with the corresponding name:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;git&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; clone git+ssh:&#x2F;&#x2F;aur@aur.archlinux.org&#x2F;package_name.git&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Use &lt;code&gt;vim PKGBUILD&lt;&#x2F;code&gt; to modify the content of &lt;code&gt;PKGBUILD&lt;&#x2F;code&gt; file.
Then try&lt;code&gt;makepkg --printsrcinfo &amp;gt; .SRCINFO&lt;&#x2F;code&gt; to create metadata file of the source. Finally, &lt;code&gt;stage -&amp;gt; commit -&amp;gt; push&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;git&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; add PKGBUILD .SRCINFO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;git&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-punctuation z-definition z-string&quot;&gt; commit -m &amp;quot;useful commit message&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;git&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; push origin master&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
        </entry><entry xml:lang="en">
        <title>Working with Manjaro KDE Linux</title>
        <published>2017-04-20T00:00:00+00:00</published>
        <updated>2017-04-20T00:00:00+00:00</updated>
        <author>
            <name>Yu Sun</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/en/blog/working-on-linux/" type="text/html"/>
        <id>https://www.bigdick.live/en/blog/working-on-linux/</id>
        
            <content type="html">&lt;h2 id=&quot;os-installation&quot;&gt;OS Installation&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Preparation of a USB media.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Download the proper &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;manjaro.org&#x2F;products&#x2F;download&#x2F;x86&#x2F;&quot;&gt;&lt;em&gt;Manjaro KDE Edition&lt;&#x2F;em&gt;&lt;&#x2F;a&gt; disc image (ISO file).&lt;&#x2F;li&gt;
&lt;li&gt;Check your device list using &lt;code&gt;sudo fdisk -l&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Run command as &lt;code&gt;sudo dd if=~&#x2F;Downloads&#x2F;manjaro-kde-17.0.1-stable-x86_64.iso of=&#x2F;dev&#x2F;sdc&lt;&#x2F;code&gt;
(You may replace the ISO file name and target device name by yourself). This will take even over 10 minutes.
For Windows user, it is highly recommended to use &lt;em&gt;Rufus&lt;&#x2F;em&gt;, which can automatically process with more than one partition. Set the options as:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;legacy-assets&#x2F;my-website&#x2F;img&#x2F;post_img&#x2F;rufus_main.png&quot; alt=&quot;rufus settings&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When it comes with a dialog box for choosing writing mode, choose as:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;legacy-assets&#x2F;my-website&#x2F;img&#x2F;post_img&#x2F;rufus_dd.png&quot; alt=&quot;rufus dd&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Restart your PC and press &lt;code&gt;F12&lt;&#x2F;code&gt; to choose boot from &lt;em&gt;USB flash driver&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Start Installation. Choose correct partition table type(&lt;code&gt;GPT&lt;&#x2F;code&gt; for UEFI supported motherboard,
with manually choose UEFI boot later. &lt;code&gt;MBR&lt;&#x2F;code&gt; for others).
You never need set a mount point of &lt;code&gt;&#x2F;home&lt;&#x2F;code&gt; at this step,
for it should be mounted with another hard disk who will storage data.
Volume of these partitions should be set as below:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Directories&lt;&#x2F;th&gt;&lt;th&gt;Volume&lt;&#x2F;th&gt;&lt;th&gt;File system&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&#x2F;boot&lt;&#x2F;td&gt;&lt;td&gt;512M &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;ext4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;swap&lt;&#x2F;td&gt;&lt;td&gt;2048M &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;Linux-swap&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&#x2F;&lt;&#x2F;td&gt;&lt;td&gt;remaining space &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;ext4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;After installation, reboot and try mount &lt;code&gt;&#x2F;home&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Use &lt;code&gt;sudo fdisk -l&lt;&#x2F;code&gt; to check all mountable devices.&lt;&#x2F;li&gt;
&lt;li&gt;Make partition: &lt;strong&gt;Suppose another hard disk is recognized as &lt;code&gt;&#x2F;dev&#x2F;sdb&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; (for example).
If its volume less than 2TB, you can simply use &lt;code&gt;fdisk&lt;&#x2F;code&gt; to make partition table for it.
Else, you may use another advanced tool like &lt;code&gt;parted&lt;&#x2F;code&gt;.
Run &lt;code&gt;parted &#x2F;dev&#x2F;sdb&lt;&#x2F;code&gt; to start, you will get a &lt;code&gt;(parted)&lt;&#x2F;code&gt; prompt.
Here we want to create only one partition, whose type is &lt;code&gt;primary&lt;&#x2F;code&gt; with &lt;code&gt;ext4&lt;&#x2F;code&gt; file system,
just type &lt;code&gt;mkpart primary ext4 0% 100%&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Some users may notice that &lt;code&gt;print&lt;&#x2F;code&gt; can be used to show information of current device, then they may use &lt;code&gt;mkpart primary ext4 0 8TB&lt;&#x2F;code&gt; (for example) to build partition table, which sometimes raise a warning message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Warning: The resulting partition is not properly aligned for best performance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Ignore&#x2F;Cancel?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The warning means the partition start is not aligned. Anyway, &lt;code&gt;0KB&lt;&#x2F;code&gt; is not real start of your disk.&lt;&#x2F;p&gt;
&lt;p&gt;What you should do is to remove all partitions on the disk then run the command like &lt;code&gt;.&#x2F;parted_mkpart_calc.sh sdb&lt;&#x2F;code&gt; (the shell script can be obtained &lt;a href=&quot;&#x2F;legacy-assets&#x2F;my-website&#x2F;code&#x2F;parted_mkpart_calc.sh&quot;&gt;here&lt;&#x2F;a&gt;), then you will see imformations like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Using default 1 MiB default alignment in calc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Calculated alignment for &#x2F;dev&#x2F;sdb (gpt) is: 2048s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;If you would be root, you could create partition with:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# parted &#x2F;dev&#x2F;sdb mkpart [name] [type] 2048s 15624996863s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Verify partition alignment with:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# parted &#x2F;dev&#x2F;sdb align-check optimal 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Should return: 1 aligned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So you can try &lt;code&gt;parted &#x2F;dev&#x2F;sdb mkpart primary ext4 2048s 15624996863s&lt;&#x2F;code&gt; and finally run &lt;code&gt;parted &#x2F;dev&#x2F;sdb align-check optimal 1&lt;&#x2F;code&gt; for checking.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol start=&quot;5&quot;&gt;
&lt;li&gt;
&lt;p&gt;Run &lt;code&gt;mkfs.ext4 -F &#x2F;dev&#x2F;sdb1&lt;&#x2F;code&gt; to reformat partition (&lt;code&gt;parted&lt;&#x2F;code&gt;’s &lt;code&gt;ext4&lt;&#x2F;code&gt; parameter doesn’t works, I don’t know why yet).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;mount &#x2F;dev&#x2F;sdb1 &#x2F;home&lt;&#x2F;code&gt; to mount new disk as &lt;code&gt;&#x2F;home&lt;&#x2F;code&gt;. To make this mount point auto-mounted,
add &lt;code&gt;&#x2F;dev&#x2F;sdb1  &#x2F;home  ext4  defaults,noatime  0  2&lt;&#x2F;code&gt; at the last line of &lt;code&gt;&#x2F;etc&#x2F;fstab&lt;&#x2F;code&gt;, then restart.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;To configure auto-starting services with &lt;code&gt;systemd&lt;&#x2F;code&gt; (use the &lt;code&gt;sshd.service&lt;&#x2F;code&gt; as example,
you may also add &lt;code&gt;teamviewerd&lt;&#x2F;code&gt; and &lt;code&gt;rstudio-server.service&lt;&#x2F;code&gt; for auto-start them):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Use the command like &lt;code&gt;sudo systemctl enable sshd.service&lt;&#x2F;code&gt; to enable the service,
and this should create a symlink in &lt;code&gt;&#x2F;etc&#x2F;systemd&#x2F;system&#x2F;multi-user.target.wants&#x2F;&lt;&#x2F;code&gt; that looks like the following
(do &lt;strong&gt;NOT&lt;&#x2F;strong&gt; create this manually):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lrwxrwxrwx 1 root root 38 Aug  1 04:43 &#x2F;etc&#x2F;systemd&#x2F;system&#x2F;multi-user.target.wants&#x2F;service.service -&amp;gt; &#x2F;usr&#x2F;lib&#x2F;systemd&#x2F;system&#x2F;service.service&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;vim &#x2F;etc&#x2F;systemd&#x2F;system&#x2F;multi-user.target.wants&#x2F;sshd.service&lt;&#x2F;code&gt; to check the content of the service file.
Make sure the file contains a line like &lt;code&gt;Restart=always&lt;&#x2F;code&gt; under the &lt;code&gt;[Service]&lt;&#x2F;code&gt; section of the file to
enable the service to respawn after a crash.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Finally, reload the &lt;code&gt;systemd daemon&lt;&#x2F;code&gt;, followed by a restart of the service:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl daemon-reload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; systemctl restart sshd.service&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If you have &#x2F;home directory on KDE platform before,
you may run &lt;code&gt;cd; rm -rf .cache .config .kde4 .local&lt;&#x2F;code&gt; to reset your KDE environment.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;autostart&quot;&gt;Autostart&lt;&#x2F;h2&gt;
&lt;p&gt;To make programs (Yakuake, etc.) autostart:
Alt + F2 -&amp;gt; autostart -&amp;gt; Add Program…&lt;&#x2F;p&gt;
&lt;h2 id=&quot;r-e-p-o&quot;&gt;R!E!P!O!&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-comment&quot;&gt;# Testing and optimizing mirrors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman-mirrors -g&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman-optimize&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt; sync&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-comment&quot;&gt;# Updating OS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman -Syyu&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;For some Chinese users, generating mirror list may raise an error (probably caused by network), you can use &lt;code&gt;sudo pacman-mirrors -g -c china&lt;&#x2F;code&gt; instead.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Then, for all Chinese users, it is better to add archlinuxcn mirror for &lt;em&gt;pacman&lt;&#x2F;em&gt;. Enter &lt;code&gt;sudo nano &#x2F;etc&#x2F;pacman.conf&lt;&#x2F;code&gt; then:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[archlinuxcn]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SigLevel = Optional TrustedOnly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Server = https:&#x2F;&#x2F;mirrors.ustc.edu.cn&#x2F;archlinuxcn&#x2F;$arch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You should put it &lt;strong&gt;bebind&lt;&#x2F;strong&gt; the main repos (for example, core) to prevent conflicts. Then:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman -Syyu&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman -S archlinuxcn-keyring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Finally, use &lt;em&gt;aurman&lt;&#x2F;em&gt; for enhanced package manager:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman -S aurman&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;&lt;strong&gt;DO NOT&lt;&#x2F;strong&gt; use &lt;em&gt;yaourt&lt;&#x2F;em&gt; any more nowadays. It’s &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;title&#x2F;AUR_helpers&quot;&gt;out of date&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;To upgrage the whole system, you should run &lt;code&gt;aurman -Syu&lt;&#x2F;code&gt; weekly.
If there’s message like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~~ the following packages are neither in known repos nor in the aur&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:: pcmciautils-018-8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then you can run &lt;code&gt;pacman -Rns $(pacman -Qtdq)&lt;&#x2F;code&gt; to remove all unused packages.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;For some Chinese users, &lt;code&gt;aurman&lt;&#x2F;code&gt; may raise connection error, you can edit &lt;code&gt;~&#x2F;.config&#x2F;aurman&#x2F;aurman_config&lt;&#x2F;code&gt; to set longer timeout for it.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[miscellaneous]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aur_timeout=100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;change-default-dns-server&quot;&gt;Change default DNS server&lt;&#x2F;h2&gt;
&lt;p&gt;Install dnsutils first, then check DNS address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman -S dnsutils&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;dig&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; www.baidu.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Edit &lt;code&gt;&#x2F;etc&#x2F;resolv.conf&lt;&#x2F;code&gt; to change DNS server by adding these lines:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Google nameservers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nameserver 8.8.8.8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nameserver 8.8.4.4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Use &lt;code&gt;sudo chattr +i &#x2F;etc&#x2F;resolv.conf&lt;&#x2F;code&gt; to set write-protection for this file (&lt;strong&gt;generally it will be reset during reboot&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;set-users-as-sudoers&quot;&gt;Set users as sudoers&lt;&#x2F;h2&gt;
&lt;p&gt;By typing &lt;code&gt;sudo visudo&lt;&#x2F;code&gt;, you can change sudoers in &lt;em&gt;vi&lt;&#x2F;em&gt; mode,
then use &lt;code&gt;&#x2F;root&lt;&#x2F;code&gt; with &lt;code&gt;n&lt;&#x2F;code&gt; (perhaps more than one time)
to change the position of cursor to the &lt;code&gt;User privilege specification&lt;&#x2F;code&gt; section.
Press &lt;code&gt;yyp&lt;&#x2F;code&gt; to copy &amp;amp; paste the current line, then &lt;code&gt;dft&lt;&#x2F;code&gt; to delete username ‘root’,
finally add the new sudoer’s username. Press &lt;code&gt;:wq&lt;&#x2F;code&gt; to save and exit.
Now this section of configuration file seems like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;##&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;## User privilege specification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;##&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root ALL=(ALL) ALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ysun ALL=(ALL) ALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;If you want add a sudoer who never need password to run commands as root, you can set as:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ysun ALL=(ALL) NOPASSWD:ALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You should only use &lt;strong&gt;one space&lt;&#x2F;strong&gt; as separator in this section (perhaps in the whole file) for correctly recognized.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;install-and-configure-softwares&quot;&gt;Install and Configure softwares&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;vim&quot;&gt;VIM&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;sudo pacman -S vim&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;teamviewer&quot;&gt;TeamViewer&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;sudo pacman -S teamviewer&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;To make TeamViewer work properly under &lt;em&gt;Fedora 25&lt;&#x2F;em&gt; with &lt;em&gt;Gnome 3&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Open the file &lt;code&gt;&#x2F;etc&#x2F;gdm&#x2F;custom.conf&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Uncomment or add the line &lt;code&gt;WaylandEnable=false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Save and reboot the system.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Sometimes TeamViewer cannot connect to server after &lt;em&gt;Arch Linux&lt;&#x2F;em&gt; system upgraded, you should &lt;strong&gt;restart&lt;&#x2F;strong&gt; then have another try.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;gcc-fortran&quot;&gt;gcc-fortran&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;sudo pacman -S gcc-fortran&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Use &lt;em&gt;gcc-fortran&lt;&#x2F;em&gt; instead of &lt;em&gt;gfortran&lt;&#x2F;em&gt; (may cause conflicts when system upgrade).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;locate&quot;&gt;locate&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pacman -S mlocate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-comment&quot;&gt;# Make cache before you first use it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; updatedb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;aria2&quot;&gt;Aria2&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;sudo pacman -S aria2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To speed up &lt;code&gt;aurman&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;It’s &lt;code&gt;makepkg&lt;&#x2F;code&gt; but not &lt;code&gt;aurman&lt;&#x2F;code&gt; downloading the packages,
so change the content of &lt;code&gt;&#x2F;etc&#x2F;makepkg.conf&lt;&#x2F;code&gt; to use &lt;code&gt;aria2&lt;&#x2F;code&gt; instead of &lt;code&gt;curl&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DLAGENTS=(&amp;#39;ftp::&#x2F;usr&#x2F;bin&#x2F;aria2c %u -o %o&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          &amp;#39;http::&#x2F;usr&#x2F;bin&#x2F;aria2c %u -o %o&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          &amp;#39;https::&#x2F;usr&#x2F;bin&#x2F;aria2c %u -o %o&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          &amp;#39;rsync::&#x2F;usr&#x2F;bin&#x2F;rsync --no-motd -z %u %o&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          &amp;#39;scp::&#x2F;usr&#x2F;bin&#x2F;scp -C %u %o&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;r-rstudio&quot;&gt;R &amp;amp;&amp;amp; RStudio&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;sudo pacman -S microsoft-r-open&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;aurman -S rstudio-desktop-bin&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For RStudio server release, run &lt;code&gt;sudo yaourt -S rstudio-server-bin&lt;&#x2F;code&gt; instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;steam&quot;&gt;Steam&lt;&#x2F;h3&gt;
&lt;p&gt;Steam outputs this error and exits.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;symbol lookup error: &#x2F;usr&#x2F;lib&#x2F;libxcb-dri3.so.0: undefined symbol: xcb_send_request_with_fds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For steam to work, disable dri3 in xorg config file or as a workaround run steam with &lt;code&gt;LIBGL_DRI3_DISABLE=1&lt;&#x2F;code&gt;.
&lt;code&gt;LIBGL_DRI3_DISABLE=1 steam&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;jetbrains-toolbox&quot;&gt;JetBrains Toolbox&lt;&#x2F;h3&gt;
&lt;p&gt;Sometimes when the toolbox started after a system upgrade, the application consumes a lot CPU and displays a empty window. To solve this problem, add starting option &lt;code&gt;--disable-seccomp-filter-sandbox&lt;&#x2F;code&gt; in the system startup menu, then restart the application.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;virtualbox&quot;&gt;Virtualbox&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;title&#x2F;VirtualBox&quot;&gt;&lt;em&gt;Arch Wiki&lt;&#x2F;em&gt;&lt;&#x2F;a&gt; here.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;for-ubuntu&quot;&gt;For ubuntu&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;install-flash-plugin-for-web-browser&quot;&gt;Install flash plugin for web browser&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt-get install flashplugin-installer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Need 190MB at least for &lt;em&gt;Fedora&lt;&#x2F;em&gt;, may even less for &lt;em&gt;Arch Linux&lt;&#x2F;em&gt;. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;As a server for bioinformatics use, we should use RAM first, so there’s no need of too much memory of &lt;code&gt;swap&lt;&#x2F;code&gt;. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;As the disk maintaining operation system, &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; should keep all remaining space. &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
        <summary type="html">Guide for say Goodbye to Windows</summary>
        </entry><entry xml:lang="en">
        <title>Break through GFW blockade with shadowsocks (built on Digital Ocean or AWS)</title>
        <published>2017-02-15T00:00:00+00:00</published>
        <updated>2017-02-15T00:00:00+00:00</updated>
        <author>
            <name>Yu Sun</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/en/blog/break-through-gfw/" type="text/html"/>
        <id>https://www.bigdick.live/en/blog/break-through-gfw/</id>
        
            <content type="html">&lt;h2 id=&quot;on-digital-ocean&quot;&gt;On &lt;em&gt;Digital Ocean&lt;&#x2F;em&gt;&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;If you’re a student, try apply for a &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;education.github.com&#x2F;pack&#x2F;&quot;&gt;student pack&lt;&#x2F;a&gt; on &lt;em&gt;GitHub&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Use code of &lt;em&gt;Digital Ocean&lt;&#x2F;em&gt; in student pack to register a &lt;strong&gt;new account&lt;&#x2F;strong&gt; and buy a droplet at &lt;em&gt;San Fransico&lt;&#x2F;em&gt; (both node 1 &amp;amp; 2 is OK, maybe 2 is better).&lt;&#x2F;li&gt;
&lt;li&gt;Install &lt;em&gt;Fedora 25 (64 bit)&lt;&#x2F;em&gt; on your VPS then do as below:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Install shadowsocks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; dnf install m2crypto python-setuptools&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;easy_install&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;pip&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install shadowsocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Shadowsocks use a json file as configuration. For all users, this file can be placed in &lt;code&gt;&#x2F;etc&lt;&#x2F;code&gt;.
Use &lt;code&gt;vi  &#x2F;etc&#x2F;shadowsocks.json&lt;&#x2F;code&gt; to edit the file and fill in contents below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;server&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;quot;0.0.0.0&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;server_port&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;quot;port&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;local_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt; &amp;quot;127.0.0.1&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;local_port&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-numeric&quot;&gt;1080&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;password&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;quot;passwd&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;timeout&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-numeric&quot;&gt;300&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;quot;rc4-md5&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;fast_open&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-language z-json&quot;&gt; false&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-type z-property-name z-json&quot;&gt;workers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation&quot;&gt;&amp;quot;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-numeric&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To keep shadowsocks running in background after you cut off SSH connection, you may use &lt;code&gt;supervisor&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; dnf install supervisor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;echo_supervisord_conf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;etc&#x2F;supervisord.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Execute &lt;code&gt;vi &#x2F;etc&#x2F;supervisord.conf&lt;&#x2F;code&gt; to configure it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[program:shadowsocks]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;command=ssserver -c &#x2F;etc&#x2F;shadowsocks.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;autostart=true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;autorestart=true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;user=nobody&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Finally, &lt;code&gt;supervisord&lt;&#x2F;code&gt; or &lt;code&gt;supervisord -c &#x2F;etc&#x2F;supervisord.conf&lt;&#x2F;code&gt; to start shadowsocks server and visit &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shadowsocks&quot;&gt;the project’s homepage&lt;&#x2F;a&gt; on GitHub for a client.
For Windows user, try https:&#x2F;&#x2F;github.com&#x2F;shadowsocks&#x2F;shadowsocks-windows&#x2F;releases.
For Linux user, &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shadowsocks&#x2F;shadowsocks-qt5&#x2F;releases&quot;&gt;shadowsocks-qt5&lt;&#x2F;a&gt; is a good choice.
There’re also &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shadowsocks&#x2F;shadowsocks-android&#x2F;releases&quot;&gt;shadowsocks for Android&lt;&#x2F;a&gt; and &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shadowsocks&#x2F;shadowsocks-iOS&#x2F;releases&quot;&gt;shadowsocks for iOS&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;appendix&quot;&gt;Appendix&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;supervisorctl status&lt;&#x2F;code&gt; for checking all processes’ status controlled by &lt;em&gt;supervisor&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;supervisorctl stop ssserver&lt;&#x2F;code&gt; for kill a process.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;supervisorctl start ssserver&lt;&#x2F;code&gt; for start a process.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;supervisorctl shutdown&lt;&#x2F;code&gt; for killing all processes controlled by &lt;em&gt;supervisor&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;known-issue&quot;&gt;Known issue&lt;&#x2F;h3&gt;
&lt;p&gt;Sometimes shadowsocks works fine in &lt;em&gt;Windows&lt;&#x2F;em&gt;,
but your browser can not visit pages in &lt;em&gt;Arch Linux&lt;&#x2F;em&gt;,
it is because that too frequently updating &lt;code&gt;libQtShadowsocks&lt;&#x2F;code&gt; brings conflict.&lt;&#x2F;p&gt;
&lt;p&gt;To &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shadowsocks&#x2F;shadowsocks-qt5&#x2F;issues&#x2F;550&quot;&gt;solve this problem&lt;&#x2F;a&gt;,
you can downgrade &lt;code&gt;libQtShadowsocks&lt;&#x2F;code&gt; or change the encryption method from &lt;code&gt;AES-256-CFB&lt;&#x2F;code&gt; to &lt;code&gt;AES-256-CTR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;on-aws&quot;&gt;On &lt;em&gt;AWS&lt;&#x2F;em&gt;&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Creat an &lt;em&gt;EC2&lt;&#x2F;em&gt; (choose &lt;em&gt;Ubuntu&lt;&#x2F;em&gt; here) instance, and be sure to keep in mind that the key pair should be generated during the process, then download your private key (.pem) file.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Change your private key’s priviledge to 400: &lt;code&gt;chmod 400 &#x2F;path&#x2F;my-key-pair.pem&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Log-in your instance with such command: &lt;code&gt;ssh -i &#x2F;path&#x2F;my-key-pair.pem ubuntu@ec2-13-124-234-100.ap-northeast-2.compute.amazonaws.com&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Upgrade OS:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt-get update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt-get dist-upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Install Shadowsocks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; apt-get install python-pip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-function&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pip install shadowsocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;You may see this error during installation of Shadowsocks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Traceback (most recent call last):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;File &amp;quot;&#x2F;usr&#x2F;bin&#x2F;pip&amp;quot;, line 11, in &amp;lt;module&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sys.exit(main())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;File &amp;quot;&#x2F;usr&#x2F;lib&#x2F;python2.7&#x2F;dist-packages&#x2F;pip&#x2F;__init__.py&amp;quot;, line 215, in main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    locale.setlocale(locale.LC_ALL, &amp;#39;&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;File &amp;quot;&#x2F;usr&#x2F;lib&#x2F;python2.7&#x2F;locale.py&amp;quot;, line 581, in setlocale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return _setlocale(category, locale)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;locale.Error: unsupported locale setting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It is caused by wrong language settings. Fix it by &lt;code&gt;export LC_ALL=C&lt;&#x2F;code&gt; (only works in &lt;strong&gt;current&lt;&#x2F;strong&gt; tty), then try again.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol start=&quot;6&quot;&gt;
&lt;li&gt;Start Shadowsocks server by: &lt;code&gt;sudo ssserver -p 2333 -k password -m rc4-md5 -d start&lt;&#x2F;code&gt; (use &lt;code&gt;2333&lt;&#x2F;code&gt; as port and &lt;code&gt;password&lt;&#x2F;code&gt; as password, change &lt;code&gt;start&lt;&#x2F;code&gt; to &lt;code&gt;stop&lt;&#x2F;code&gt; if you wanna stop the process).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;You should use &lt;code&gt;AES-256-CTR&lt;&#x2F;code&gt; as encryption method at ArchLinux to avoid problems brought by over-updated &lt;code&gt;libqtshadowsocks&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;optimization&quot;&gt;Optimization&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;break-though-limit-of-file-open-number&quot;&gt;Break though limit of file open number&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Edit &lt;code&gt;limits.conf&lt;&#x2F;code&gt;: &lt;code&gt;sudo vi &#x2F;etc&#x2F;security&#x2F;limits.conf&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Add those two lines:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* soft nofile 51200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* hard nofile 51200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Restart the OS.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;improve-system-performance&quot;&gt;Improve system performance&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Edit &lt;code&gt;sysctl.conf&lt;&#x2F;code&gt;: &lt;code&gt;sudo vi &#x2F;etc&#x2F;sysctl.conf&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Add these lines:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fs.file-max = 51200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.core.rmem_max = 67108864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.core.wmem_max = 67108864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.core.netdev_max_backlog = 250000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.core.somaxconn = 4096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_syncookies = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_tw_reuse = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_tw_recycle = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_fin_timeout = 30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_keepalive_time = 1200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.ip_local_port_range = 10000 65000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_max_syn_backlog = 8192&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_max_tw_buckets = 5000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_fastopen = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_rmem = 4096 87380 67108864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_wmem = 4096 65536 67108864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_mtu_probing = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.tcp_congestion_control = hybla&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Run &lt;code&gt;sudo sysctl -p&lt;&#x2F;code&gt; to reload settings.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;serverspeeder&quot;&gt;ServerSpeeder&lt;&#x2F;h4&gt;
&lt;p&gt;ServerSpeeder cannot be used on Ubuntu 16.04 now.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;net-speeder&quot;&gt;net-speeder&lt;&#x2F;h4&gt;
&lt;p&gt;net-speeder will double the network traffic. Not recommended.&lt;&#x2F;p&gt;
</content>
        <summary type="html">Guide to break through Chinese government&#x27;s GFW</summary>
        </entry><entry xml:lang="en">
        <title>Perl oneliners for Bioinformatics</title>
        <published>2017-02-09T00:00:00+00:00</published>
        <updated>2017-02-09T00:00:00+00:00</updated>
        <author>
            <name>Yu Sun</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/en/blog/perl-oneliners/" type="text/html"/>
        <id>https://www.bigdick.live/en/blog/perl-oneliners/</id>
        
            <content type="html">&lt;p&gt;To use most of one-liners in this post, you should:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If you’re working on &lt;em&gt;Windows&lt;&#x2F;em&gt;, download and install &lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;downloads.activestate.com&#x2F;&quot;&gt;ActiveState Perl&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Replace variable &lt;code&gt;$file&lt;&#x2F;code&gt; at the end of scripts by the real file name.&lt;&#x2F;li&gt;
&lt;li&gt;Run the script as a command in &lt;code&gt;CMD&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#extract-a-reference-sequence-from-a-single-query-fasta-file&quot;&gt;Extract a reference sequence from a single-query &lt;em&gt;FASTA&lt;&#x2F;em&gt; file&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#find-plain-text-files-with-same-appendix-in-multiple-directories-recursively-and-merge-them-into-one-file&quot;&gt;Find plain-text files with same appendix in multiple directories recursively and merge them into one file&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#filter-fastq-by-length-of-query&quot;&gt;Filter &lt;em&gt;FASTQ&lt;&#x2F;em&gt; by length of query&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#to-flare-out-fasta-queries&quot;&gt;To “flare out” &lt;em&gt;FASTA&lt;&#x2F;em&gt; queries&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#to-calculate-the-proportion-of-gaps-n-or-n-in-a-genome&quot;&gt;To calculate the proportion of gaps (“N” or “n”) in a genome&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#to-get-reads-in-fastq-with-specific-length-and-count-in-descending-order&quot;&gt;To get reads in &lt;em&gt;FASTQ&lt;&#x2F;em&gt; with specific length and count in descending order&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#to-calculate-positive-and-negtive-read-counts-separately&quot;&gt;To calculate positive and negtive read counts separately&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#to-print-file-names-in-current-directory&quot;&gt;To print file names in current directory&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#to-remove-all-patches-and-scaffolds-etc-but-leave-only-chromosomes-in-a-genome-reference-file&quot;&gt;To remove all patches and scaffolds etc., but leave only chromosomes in a genome reference file.&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;blog&#x2F;perl-oneliners&#x2F;#to-convert-fastq-into-fasta&quot;&gt;To convert &lt;em&gt;FASTQ&lt;&#x2F;em&gt; into &lt;em&gt;FASTA&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;extract-a-reference-sequence-from-a-single-query-fasta-file&quot;&gt;Extract a reference sequence from a single-query &lt;em&gt;FASTA&lt;&#x2F;em&gt; file&lt;&#x2F;h2&gt;
&lt;p&gt;Replace the scalar $start and $end with two number indicating location then execute.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-function&quot;&gt;ne&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt; &amp;#39;next if &#x2F;^&amp;gt;&#x2F;; $_ =~ s&#x2F;[\r\n]+&#x2F;&#x2F;g; @a = split &#x2F;&#x2F;, $_; for (@a) {$i ++; if(($i &amp;gt;= $start) &amp;amp;&amp;amp; ($i &amp;lt;= $end)) {print}}&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;find-plain-text-files-with-same-appendix-in-multiple-directories-recursively-and-merge-them-into-one-file&quot;&gt;Find plain-text files with same appendix in multiple directories recursively and merge them into one file&lt;&#x2F;h2&gt;
&lt;p&gt;Replace the scalar $append with the suffix (e.g. .seq) then execute.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -MFile::Find -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-function&quot;&gt;le&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt; &amp;quot;sub search{if (&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;append&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;){(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$id&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;) = map{&#x2F;.+_(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.+).seq&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;} &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$_&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;; open(SEQ, qq{&amp;lt;}, &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$File::Find::name&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;) or die qq{Processing:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$File::Find::name&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$!&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}; while(&amp;lt;SEQ&amp;gt;) {print MERGE qq{&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$id&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}; print MERGE &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$_&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;} }} open MERGE, qq{&amp;gt;}, qq{sanger.fa}; find({ wanted =&amp;gt; &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-punctuation z-definition z-string&quot;&gt;search, no_chdir =&amp;gt; 1 }, qq{.})&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;filter-fastq-by-length-of-query&quot;&gt;Filter &lt;em&gt;FASTQ&lt;&#x2F;em&gt; by length of query&lt;&#x2F;h2&gt;
&lt;p&gt;Replace the scalar $minlen and $maxlen with the number representing interval then execute.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -lane &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;quot;if (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$.&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; % 4 == 1) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$id&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$_&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; =~ s&#x2F;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\r\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]+&#x2F;&#x2F;r} elsif (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$.&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; % 4 == 2) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$seq&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$_&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; =~ s&#x2F;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\r\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]+&#x2F;&#x2F;r} elsif (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$.&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; % 4 == 3) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$name&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$_&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; =~ s&#x2F;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\r\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]+&#x2F;&#x2F;r} else {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$qual&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable&quot;&gt;$_&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; =~ s&#x2F;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\r\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]+&#x2F;&#x2F;r; print qq{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$id&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$seq&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$name&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$qual&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;} if ((length(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$seq&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;) &amp;gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$minlen&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;) &amp;amp;&amp;amp; (length(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$seq&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;) &amp;lt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt;$maxlen&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-punctuation z-definition z-string&quot;&gt;))}&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;to-flare-out-fasta-queries&quot;&gt;To “flare out” &lt;em&gt;FASTA&lt;&#x2F;em&gt; queries&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;FASTA&lt;&#x2F;em&gt; is a file format and is recommended that all lines of text be shorter than 80 characters.
However, when we need to grep continuous strings in it, the line break such as &lt;code&gt;[\r\n]&lt;&#x2F;code&gt; usually cause troubles.
Use this command can remove newline characters in sequences.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -pe &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;#39;$. == 1 ? 23333333 : &#x2F;^&amp;gt;&#x2F; ? $_ = qq{\n} . $_ : s&#x2F;[\r\n]+&#x2F;&#x2F;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;to-calculate-the-proportion-of-gaps-n-or-n-in-a-genome&quot;&gt;To calculate the proportion of gaps (“N” or “n”) in a genome&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -lne &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;#39;next if &#x2F;^&amp;gt;&#x2F;; $_ =~ s&#x2F;[\r\n]+&#x2F;&#x2F;; $total_len += length($_); $n_count += map{&#x2F;[nN]&#x2F;g} $_ }{ END{print qq{Total length: $total_len}; print qq{N count: $n_count}; $n_ratio = $n_count &#x2F; $total_len; print qq{N ratio: $n_ratio}}&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;to-get-reads-in-fastq-with-specific-length-and-count-in-descending-order&quot;&gt;To get reads in &lt;em&gt;FASTQ&lt;&#x2F;em&gt; with specific length and count in descending order&lt;&#x2F;h2&gt;
&lt;p&gt;Replace the scalar &lt;code&gt;$length&lt;&#x2F;code&gt; with the length you’re interested in (without unit such as “bp”) then execute.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -lne &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;#39;next unless (($. % 4 == 2)&amp;amp;&amp;amp;(length($_) == $length)); $count{$_}++; }{ for (sort {$count{$b} &amp;lt;=&amp;gt; $count{$a}} keys %count) {print qq{$_\t$count{$_}}}&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;to-calculate-positive-and-negtive-read-counts-separately&quot;&gt;To calculate positive and negtive read counts separately&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -lane &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;#39;next if &#x2F;^@&#x2F;; next if $F[1]&amp;amp;0x4; $len = eval join q{+}, map {&#x2F;(\d+)[MID]&#x2F;g} $F[5]; $pos{$len} ++ if $F[1] == 0; $neg{$len} ++ if $F[1] == 16 }{ print qq{$_\t$pos{$_}} for (keys %pos); print qq{$_\t-$neg{$_}} for (keys %neg)&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;to-print-file-names-in-current-directory&quot;&gt;To print file names in current directory&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-function&quot;&gt;le&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt; &amp;quot;print for (glob qq{*})&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;to-remove-all-patches-and-scaffolds-etc-but-leave-only-chromosomes-in-a-genome-reference-file&quot;&gt;To remove all patches and scaffolds etc., but leave only chromosomes in a genome reference file.&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -lpe &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;#39;&#x2F;^&amp;gt;&#x2F; &amp;amp;&amp;amp; !&#x2F;REF$&#x2F; ? last : &#x2F;^&amp;gt;&#x2F; ? $_ =~ s&#x2F;&amp;gt;(\w+)&#x2F;&amp;gt;chr$1&#x2F; : 23333333&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;to-convert-fastq-into-fasta&quot;&gt;To convert &lt;em&gt;FASTQ&lt;&#x2F;em&gt; into &lt;em&gt;FASTA&lt;&#x2F;em&gt;&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-source&quot;&gt;perl -F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;#39;@&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source&quot;&gt; -lanE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-string&quot;&gt;&amp;#39;$. % 4 == 1 ? say qq{&amp;gt;$F[1]} : $. % 4 == 2 ? say $_ : $. % 4 == 3 ? qq{Yu Sun is handsome} : 233333333&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-variable z-other z-readwrite&quot;&gt; $file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
        <summary type="html">Here I place some Perl-oneliners (may be not common used) by me. You can use them to modify, count , summarize or change file type on plain-text (like fastx).</summary>
        </entry><entry xml:lang="en">
        <title>Dota2 Automation Scripts</title>
        <published>2016-05-21T00:00:00+00:00</published>
        <updated>2016-05-21T00:00:00+00:00</updated>
        <author>
            <name>Yu Sun</name>
        </author>
        <link rel="alternate" href="https://www.bigdick.live/en/projects/dota2-automation-scripts/" type="text/html"/>
        <id>https://www.bigdick.live/en/projects/dota2-automation-scripts/</id>
        
            <content type="html">&lt;p&gt;These are two Dota2 automation scripts from 2016, preserved as they were rather than presented as maintained tools.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;contents&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#contents&quot; aria-label=&quot;Anchor link for: contents&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Contents&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bioinformatist&#x2F;bioinformatist.github.io&#x2F;blob&#x2F;main&#x2F;static&#x2F;archives&#x2F;legacy-dota2-automation&#x2F;dota2_lumbering_challenge.py&quot;&gt;Dota2 lumbering challenge auto-clicker&lt;&#x2F;a&gt;: a Windows &#x2F; Python script that listens for &lt;code&gt;Ctrl+C&lt;&#x2F;code&gt; and randomly clicks inside a fixed screen area for &lt;code&gt;60&lt;&#x2F;code&gt; seconds.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bioinformatist&#x2F;bioinformatist.github.io&#x2F;blob&#x2F;main&#x2F;static&#x2F;archives&#x2F;legacy-dota2-automation&#x2F;auto_spectate.sh&quot;&gt;Dota2 Source 2 auto-spectating script&lt;&#x2F;a&gt;: a Linux &#x2F; X11 script that uses &lt;code&gt;xdotool&lt;&#x2F;code&gt; to activate the Dota2 window and periodically click the spectating entry point.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;lumbering-challenge&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#lumbering-challenge&quot; aria-label=&quot;Anchor link for: lumbering-challenge&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Lumbering Challenge&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;projects&#x2F;dota2-automation-scripts&#x2F;chopping.gif&quot; alt=&quot;Auto-clicking demo&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The idea was simple: trigger from the keyboard, then simulate mouse clicks in the game area.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;www.bigdick.live&#x2F;en&#x2F;projects&#x2F;dota2-automation-scripts&#x2F;chopping_result.png&quot; alt=&quot;Lumbering result&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
</content>
        <summary type="html">Two Dota2 automation scripts from 2016: lumbering challenge auto-clicking and Source 2 auto-spectating.</summary>
        </entry>
</feed>
