<rss
      xmlns:atom="http://www.w3.org/2005/Atom"
      xmlns:media="http://search.yahoo.com/mrss/"
      xmlns:content="http://purl.org/rss/1.0/modules/content/"
      xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      version="2.0"
    >
      <channel>
        <title><![CDATA[Shinoa Fores 死の灰]]></title>
        <description><![CDATA[E Crypto Libertas  | PGP: 0x260FA57BCE677A5C04BF60BA4A75883CC1B1D34C]]></description>
        <link>https://shinohai.npub.pro/tag/news/</link>
        <atom:link href="https://shinohai.npub.pro/tag/news/rss/" rel="self" type="application/rss+xml"/>
        <itunes:new-feed-url>https://shinohai.npub.pro/tag/news/rss/</itunes:new-feed-url>
        <itunes:author><![CDATA[Shinoa Fores 死の灰]]></itunes:author>
        <itunes:subtitle><![CDATA[E Crypto Libertas  | PGP: 0x260FA57BCE677A5C04BF60BA4A75883CC1B1D34C]]></itunes:subtitle>
        <itunes:type>episodic</itunes:type>
        <itunes:owner>
          <itunes:name><![CDATA[Shinoa Fores 死の灰]]></itunes:name>
          <itunes:email><![CDATA[Shinoa Fores 死の灰]]></itunes:email>
        </itunes:owner>
            
      <pubDate>Sun, 02 Jun 2024 18:07:36 GMT</pubDate>
      <lastBuildDate>Sun, 02 Jun 2024 18:07:36 GMT</lastBuildDate>
      
      <itunes:image href="https://btc.info.gf/nostr/0/avatar.gif" />
      <image>
        <title><![CDATA[Shinoa Fores 死の灰]]></title>
        <link>https://shinohai.npub.pro/tag/news/</link>
        <url>https://btc.info.gf/nostr/0/avatar.gif</url>
      </image>
      <item>
      <title><![CDATA[Installing python nostr_relay on Android via termux]]></title>
      <description><![CDATA[]]></description>
             <itunes:subtitle><![CDATA[]]></itunes:subtitle>
      <pubDate>Sun, 02 Jun 2024 18:07:36 GMT</pubDate>
      <link>https://shinohai.npub.pro/post/installing-python-nostr-relay-on-android-via-termux-k1dmnr/</link>
      <comments>https://shinohai.npub.pro/post/installing-python-nostr-relay-on-android-via-termux-k1dmnr/</comments>
      <guid isPermaLink="false">naddr1qqayjmnnw3skcmrfdenj6urew35x7m3ddehhxarj94ex2mrp0ykk7m3dg9hxgun0d9jz6anfvykhgetjd46hstttx9jx6mnjqgsyh3uc938wgput9td9xs9wvul335ak5ejtr7t734nenes8fj6u88grqsqqqa289zsh4r</guid>
      <category>News</category>
      
        <media:content url="https://blossom.primal.net/1dbad0bc985237c43a03ef93dcdd31eb73e0af597468fafeb42511293d769f9d.png" medium="image"/>
        <enclosure 
          url="https://blossom.primal.net/1dbad0bc985237c43a03ef93dcdd31eb73e0af597468fafeb42511293d769f9d.png" length="0" 
          type="image/png" 
        />
      <noteId>naddr1qqayjmnnw3skcmrfdenj6urew35x7m3ddehhxarj94ex2mrp0ykk7m3dg9hxgun0d9jz6anfvykhgetjd46hstttx9jx6mnjqgsyh3uc938wgput9td9xs9wvul335ak5ejtr7t734nenes8fj6u88grqsqqqa289zsh4r</noteId>
      <npub>npub1f0restzwusrck2k62dq2ueelrrfmdfnyk8uhart8n8nqwn94cwwsppm0sa</npub>
      <dc:creator><![CDATA[Shinoa Fores 死の灰]]></dc:creator>
      <content:encoded><![CDATA[<p>I rarely use smartphones for their intended purpose, instead using them as cheap and portable "mini machines" thanks to termux. Since joining nostr and learning how relays work, I got to wondering if running a relay from my test phone would be possible. After many hours of failed attempts and chairs thrown through windows, here's how I finally got python nostr_relay to work on my device.</p>
<p>YOU WILL NEED - An android device with latest Termux from FDROID OR GITHUB (The Google Play version will not work). You will need python 3.x,clang, and git installed in this environment.</p>
<p>Step 1. Start sshd in termux and log into your device.</p>
<p>Step 2. User must modify their python sysconfigdata manually, since the Android NDK with latest clang does not support the -fopenmp-implicit-rpath  flag and will cause any .toml based python wheel builds to fail. Simply run the following commands in your termux terminal to fix this (A backup up your original sysconfig files will be saved, this example shows the steps being performed for python 3.11):</p>
<p>_file="$(find $PREFIX/lib/python3.11 -name "_sysconfigdata*.py")"<br>rm -rf $PREFIX/lib/python3.11/<strong>pycache</strong><br>cp $_file "$_file".backup<br>sed -i 's|-fno-openmp-implicit-rpath||g' "$_file"  </p>
<p>Step 3. Make a directory for the install and switch to it, I am using "devel"  in this example:</p>
<p>mkdir -p devel &amp;&amp; cd $_  </p>
<p>Step 4. Clone the nostr_relay repo, I have mirrored the latest version to Github for those that hate fossil as much as I do:</p>
<p>git clone <np-embed url="https://github.com/Shinoa-Fores/nostr_relay.git"><a href="https://github.com/Shinoa-Fores/nostr_relay.git">https://github.com/Shinoa-Fores/nostr_relay.git</a></np-embed>  </p>
<p>Step 5. Make a python virtual environment and activate it:</p>
<p>python3.11 -m venv nostr_relay<br>cd nostr_relay<br>source bin/activate  </p>
<p>Step 6. Pycares is a required dependency for toml-based projects, and also will not install properly via pip under termux so we will install it from sources in the venv and apply a quick fix to that too:</p>
<p>wget <np-embed url="https://files.pythonhosted.org/packages/1b/8f/daf60bbc06f4a3cd1cfb0ab807057151287df6f5c78f2e0d298acc9193ac/pycares-4.4.0.tar.gz"><a href="https://files.pythonhosted.org/packages/1b/8f/daf60bbc06f4a3cd1cfb0ab807057151287df6f5c78f2e0d298acc9193ac/pycares-4.4.0.tar.gz">https://files.pythonhosted.org/packages/1b/8f/daf60bbc06f4a3cd1cfb0ab807057151287df6f5c78f2e0d298acc9193ac/pycares-4.4.0.tar.gz</a></np-embed><br>tar -xf pycares-4.4.0.tar.gz<br>sed -i s/'#define HAVE_GETSERVBYPORT_R 1'//g ./pycares-4.4.0/deps/build-config/config_android/ares_config.h<br>pip install ./pycares-4.4.0<br>rm -rf pycares-4.4.0 pycares-4.4.0.tar.gz </p>
<p>Step 7. Now install the remaining dependencies and nostr-Relay itself:</p>
<p>pip install -e .  </p>
<p>Step 8. Make a cup of tea and shitpost on nostr until the build completes. </p>
<p>Step 9. Once build is finished, copy the included sample config and open in your preferred text editor to adjust the parameters to your liking:</p>
<p>cp nostr_relay/config.yaml .  </p>
<p>Step 10. Make a startup script for the relay and fire up your portable relay. In the example below I start it in a screen session so the process does not die if I lose ssh or termux connection.</p>
<p>cat &gt;start-relay.sh &lt;&lt; EOF<br>#!/usr/bin/env bash<br>set -eu<br>set -o pipefail<br>bin/nostr-relay -c ./config.yaml serve<br>EOF    </p>
<p>chmod +x start-relay.sh  </p>
<p>screen -S relay -dm bash ./start-relay.sh  </p>
<p>Step 11. If all goes well you should see something like this:</p>
<p><img src="https://image.nostr.build/29880353beecd8ba65c3ab68f97f2d4610bc7f8087ef9df70f868561d6b95c4d.jpg" alt=""></p>
<p>Still here? Good! The reader is invited to tinker with this configuration and enhance it. Things like setting up DNS and tor are beyond the scope of this post, but information on the latter can be found on the termux wiki: <np-embed url="https://wiki.termux.com/wiki/Bypassing_NAT"><a href="https://wiki.termux.com/wiki/Bypassing_NAT">https://wiki.termux.com/wiki/Bypassing_NAT</a></np-embed> .</p>
]]></content:encoded>
      <itunes:author><![CDATA[Shinoa Fores 死の灰]]></itunes:author>
      <itunes:summary><![CDATA[<p>I rarely use smartphones for their intended purpose, instead using them as cheap and portable "mini machines" thanks to termux. Since joining nostr and learning how relays work, I got to wondering if running a relay from my test phone would be possible. After many hours of failed attempts and chairs thrown through windows, here's how I finally got python nostr_relay to work on my device.</p>
<p>YOU WILL NEED - An android device with latest Termux from FDROID OR GITHUB (The Google Play version will not work). You will need python 3.x,clang, and git installed in this environment.</p>
<p>Step 1. Start sshd in termux and log into your device.</p>
<p>Step 2. User must modify their python sysconfigdata manually, since the Android NDK with latest clang does not support the -fopenmp-implicit-rpath  flag and will cause any .toml based python wheel builds to fail. Simply run the following commands in your termux terminal to fix this (A backup up your original sysconfig files will be saved, this example shows the steps being performed for python 3.11):</p>
<p>_file="$(find $PREFIX/lib/python3.11 -name "_sysconfigdata*.py")"<br>rm -rf $PREFIX/lib/python3.11/<strong>pycache</strong><br>cp $_file "$_file".backup<br>sed -i 's|-fno-openmp-implicit-rpath||g' "$_file"  </p>
<p>Step 3. Make a directory for the install and switch to it, I am using "devel"  in this example:</p>
<p>mkdir -p devel &amp;&amp; cd $_  </p>
<p>Step 4. Clone the nostr_relay repo, I have mirrored the latest version to Github for those that hate fossil as much as I do:</p>
<p>git clone <np-embed url="https://github.com/Shinoa-Fores/nostr_relay.git"><a href="https://github.com/Shinoa-Fores/nostr_relay.git">https://github.com/Shinoa-Fores/nostr_relay.git</a></np-embed>  </p>
<p>Step 5. Make a python virtual environment and activate it:</p>
<p>python3.11 -m venv nostr_relay<br>cd nostr_relay<br>source bin/activate  </p>
<p>Step 6. Pycares is a required dependency for toml-based projects, and also will not install properly via pip under termux so we will install it from sources in the venv and apply a quick fix to that too:</p>
<p>wget <np-embed url="https://files.pythonhosted.org/packages/1b/8f/daf60bbc06f4a3cd1cfb0ab807057151287df6f5c78f2e0d298acc9193ac/pycares-4.4.0.tar.gz"><a href="https://files.pythonhosted.org/packages/1b/8f/daf60bbc06f4a3cd1cfb0ab807057151287df6f5c78f2e0d298acc9193ac/pycares-4.4.0.tar.gz">https://files.pythonhosted.org/packages/1b/8f/daf60bbc06f4a3cd1cfb0ab807057151287df6f5c78f2e0d298acc9193ac/pycares-4.4.0.tar.gz</a></np-embed><br>tar -xf pycares-4.4.0.tar.gz<br>sed -i s/'#define HAVE_GETSERVBYPORT_R 1'//g ./pycares-4.4.0/deps/build-config/config_android/ares_config.h<br>pip install ./pycares-4.4.0<br>rm -rf pycares-4.4.0 pycares-4.4.0.tar.gz </p>
<p>Step 7. Now install the remaining dependencies and nostr-Relay itself:</p>
<p>pip install -e .  </p>
<p>Step 8. Make a cup of tea and shitpost on nostr until the build completes. </p>
<p>Step 9. Once build is finished, copy the included sample config and open in your preferred text editor to adjust the parameters to your liking:</p>
<p>cp nostr_relay/config.yaml .  </p>
<p>Step 10. Make a startup script for the relay and fire up your portable relay. In the example below I start it in a screen session so the process does not die if I lose ssh or termux connection.</p>
<p>cat &gt;start-relay.sh &lt;&lt; EOF<br>#!/usr/bin/env bash<br>set -eu<br>set -o pipefail<br>bin/nostr-relay -c ./config.yaml serve<br>EOF    </p>
<p>chmod +x start-relay.sh  </p>
<p>screen -S relay -dm bash ./start-relay.sh  </p>
<p>Step 11. If all goes well you should see something like this:</p>
<p><img src="https://image.nostr.build/29880353beecd8ba65c3ab68f97f2d4610bc7f8087ef9df70f868561d6b95c4d.jpg" alt=""></p>
<p>Still here? Good! The reader is invited to tinker with this configuration and enhance it. Things like setting up DNS and tor are beyond the scope of this post, but information on the latter can be found on the termux wiki: <np-embed url="https://wiki.termux.com/wiki/Bypassing_NAT"><a href="https://wiki.termux.com/wiki/Bypassing_NAT">https://wiki.termux.com/wiki/Bypassing_NAT</a></np-embed> .</p>
]]></itunes:summary>
      <itunes:image href="https://blossom.primal.net/1dbad0bc985237c43a03ef93dcdd31eb73e0af597468fafeb42511293d769f9d.png"/>
      </item>
      
      <item>
      <title><![CDATA[Gentoo chroot on android 10 device]]></title>
      <description><![CDATA[]]></description>
             <itunes:subtitle><![CDATA[]]></itunes:subtitle>
      <pubDate>Tue, 21 May 2024 05:00:00 GMT</pubDate>
      <link>https://shinohai.npub.pro/post/1716327871630/</link>
      <comments>https://shinohai.npub.pro/post/1716327871630/</comments>
      <guid isPermaLink="false">naddr1qqxnzde3xcenydecxucnvvesqgsyh3uc938wgput9td9xs9wvul335ak5ejtr7t734nenes8fj6u88grqsqqqa28tky20u</guid>
      <category>News</category>
      
        <media:content url="https://blossom.primal.net/c0ef15c622fb752a0c1f77f9419420944914eba7addff8bf3abe9d074c6af336.png" medium="image"/>
        <enclosure 
          url="https://blossom.primal.net/c0ef15c622fb752a0c1f77f9419420944914eba7addff8bf3abe9d074c6af336.png" length="0" 
          type="image/png" 
        />
      <noteId>naddr1qqxnzde3xcenydecxucnvvesqgsyh3uc938wgput9td9xs9wvul335ak5ejtr7t734nenes8fj6u88grqsqqqa28tky20u</noteId>
      <npub>npub1f0restzwusrck2k62dq2ueelrrfmdfnyk8uhart8n8nqwn94cwwsppm0sa</npub>
      <dc:creator><![CDATA[Shinoa Fores 死の灰]]></dc:creator>
      <content:encoded><![CDATA[<p><em>(Note: This was originally published on my personal blog on June 06, 2021. I am republishing here to nostr to experiment with long-form notes)</em></p>
<p> I was in a pinch over the weekend and needed a quick gentoo env to test something but only had my stupid android 10 smartphone with me, so wat do? I'm documenting the following recipe that (so far) works for me and preserving the tarball here to my www for possible future needs.</p>
<p>Grab the stage3 for armv7 using curl inside termux.</p>
<pre><code>curl -sSL4 http://btc.info.gf/devel/gentoo/arm/android/stage3-arm64-20200704.tar.xz
</code></pre>
<p>Gotta fucking fix hardlinks cuz of some android kernel herpderpery so we use proot, also from termux.</p>
<pre><code>proot --link2symlink tar -C $GENTOO/data -xf stage3-arm64-20200704.tar.xz
</code></pre>
<p>Now make a script that starts up the chroot inside termux and fire it off:</p>
<pre><code>cat &gt;chroot.sh &lt;&lt; EOF
#!/usr/bin/env bash
set -eu
set -o pipefail
unset LD_PRELOAD
export GENTOO=/data/data/com.termux/gentoo
export EPREFIX=/data/gentoo64

proot --link2symlink -r $GENTOO -0 -w / \
    -b /dev -b /proc -b /sys \
    $EPREFIX/bin/sh -c \
    "HOME=$EPREFIX/root $EPREFIX/startprefix"
EOF

chmod +x chroot.sh

sh chroot.sh
</code></pre>
<p>Now from inside the chroot, fix your <code>/etc/resolv.conf</code> since this can't be copied from android system. Then source your profile and set ENV.</p>
<pre><code>source /etc/profile
export PS1="(chroot) $PS1"
</code></pre>
<p><img src="https://btc.info.gf/blog/media/img/gentoodroid.jpg" alt="Gentoo on Android 10"></p>
<p>Normally this is the step where one sets up portage, but resist the temptation to <code>emerge-webrsync</code> here. I'd simply crossdev the packages I needed on a much more capable machine and set up my <code>/etc/portage/make.conf</code> to emerge packages from a local binhost.</p>
<p>CAVEATS</p>
<p>This thing will bitch about <code>proc/</code> not being mounted on most devices. However, I'm able to see chroot processes inside htop in another termux session.</p>
<p>Because of the extreme minimal size of the environment, user is expected to be capable of building their own env using crossdev as explained above</p>
<p>UPDATE: I forgot to mention that I mounted one of these Kingston 8GB microsd cards before unpacking the fs:<br><img src="https://btc.info.gf/blog/media/img/droidfs.jpg" alt="SD Card"></p>
]]></content:encoded>
      <itunes:author><![CDATA[Shinoa Fores 死の灰]]></itunes:author>
      <itunes:summary><![CDATA[<p><em>(Note: This was originally published on my personal blog on June 06, 2021. I am republishing here to nostr to experiment with long-form notes)</em></p>
<p> I was in a pinch over the weekend and needed a quick gentoo env to test something but only had my stupid android 10 smartphone with me, so wat do? I'm documenting the following recipe that (so far) works for me and preserving the tarball here to my www for possible future needs.</p>
<p>Grab the stage3 for armv7 using curl inside termux.</p>
<pre><code>curl -sSL4 http://btc.info.gf/devel/gentoo/arm/android/stage3-arm64-20200704.tar.xz
</code></pre>
<p>Gotta fucking fix hardlinks cuz of some android kernel herpderpery so we use proot, also from termux.</p>
<pre><code>proot --link2symlink tar -C $GENTOO/data -xf stage3-arm64-20200704.tar.xz
</code></pre>
<p>Now make a script that starts up the chroot inside termux and fire it off:</p>
<pre><code>cat &gt;chroot.sh &lt;&lt; EOF
#!/usr/bin/env bash
set -eu
set -o pipefail
unset LD_PRELOAD
export GENTOO=/data/data/com.termux/gentoo
export EPREFIX=/data/gentoo64

proot --link2symlink -r $GENTOO -0 -w / \
    -b /dev -b /proc -b /sys \
    $EPREFIX/bin/sh -c \
    "HOME=$EPREFIX/root $EPREFIX/startprefix"
EOF

chmod +x chroot.sh

sh chroot.sh
</code></pre>
<p>Now from inside the chroot, fix your <code>/etc/resolv.conf</code> since this can't be copied from android system. Then source your profile and set ENV.</p>
<pre><code>source /etc/profile
export PS1="(chroot) $PS1"
</code></pre>
<p><img src="https://btc.info.gf/blog/media/img/gentoodroid.jpg" alt="Gentoo on Android 10"></p>
<p>Normally this is the step where one sets up portage, but resist the temptation to <code>emerge-webrsync</code> here. I'd simply crossdev the packages I needed on a much more capable machine and set up my <code>/etc/portage/make.conf</code> to emerge packages from a local binhost.</p>
<p>CAVEATS</p>
<p>This thing will bitch about <code>proc/</code> not being mounted on most devices. However, I'm able to see chroot processes inside htop in another termux session.</p>
<p>Because of the extreme minimal size of the environment, user is expected to be capable of building their own env using crossdev as explained above</p>
<p>UPDATE: I forgot to mention that I mounted one of these Kingston 8GB microsd cards before unpacking the fs:<br><img src="https://btc.info.gf/blog/media/img/droidfs.jpg" alt="SD Card"></p>
]]></itunes:summary>
      <itunes:image href="https://blossom.primal.net/c0ef15c622fb752a0c1f77f9419420944914eba7addff8bf3abe9d074c6af336.png"/>
      </item>
      
      </channel>
      </rss>
    