Snott

Category: Tech

Technology related, bleeding edge tips, ongoing experiments etc etc.

  • Automating Sia for hosting

    Automating Sia for hosting

    Sia is an Open Source Decentralized storage platform, which splits apart, encrypts, and distributes your files across a decentralized network. Since you hold the keys, you own your data. No outside company can access or control your files, unlike traditional cloud storage providers.

    Below is a quick and simple way to integrate siad (the process sia runs) with systemctl, so that you can control it from within systemd the normal way you control the rest of your processes on a Linux System.

    Systemd unit file (put this in /usr/lib/systemd/system/sia.service):

    [Unit]
    Description=Sia daemon
    After=network.target
    
    [Service]
    Type=simple
    User=sia
    Nice=5
    # WorkingDirectory may not be required but to be sure.
    WorkingDirectory=/sia
    # This could be more dynamic, but if we don't limit this, we will get swap problems.
    # Legacy setting for use with cgroups v1.
    MemoryLimit=3.5G
    # Unified hierarchy, supported starting with systemd 231 and later, while CentOS 7 uses 219.
    #MemoryHigh=3G
    #MemoryMax=3.5G
    # Introduced with systemd 232 while CentOS 7 uses 219.
    #MemorySwapMax=0
    ExecStart=/sia/siad --sia-directory /sia
    Restart=on-failure
    RestartSec=30
    
    [Install]
    WantedBy=multi-user.target
    ---
    
    Do systemctl edit sia, an editor will open, add the following:
    [Service]
    Environment="SIA_WALLET_PASSWORD=word1 word2 whatever etc omg lol rofl lmao"
    
    That will make the environment variable accessible from the service so that the wallet is auto-unlocked every time the service starts
    Now you can do "systemctl status|start|stop|restart sia" and if the process fails it will restart by itself within 30 secs.
  • Do you remember how [insert website url here] looked like 10 years ago?

    Do you remember how [insert website url here] looked like 10 years ago?

    Today I have some pretty awesome website to show you, the Internet Archive has put together something called The Wayback Machine:

    An organization called the Internet Archive has been taking snapshots of web pages on the World Wide Web since 1996. The Wayback Machine is a tool that allows users to surf those archived versions of web pages. Visitors to the Wayback Machine can type in a URL (i.e. a website address), select a date range, and then begin surfing on an archived version of that web site. As of the end of 2006, the Internet Archive had archived 85 billion web pages.

    This is very funny when you look at a site you have visited your entire life and see that it looked TERRIBLE 10 or more years ago, take the Archlinux Website for example (first snapshot in March 28, 2002):

    http://web.archive.org/web/20020328043401/http://www.archlinux.org/

    You can use the bar at the top to travel trough time until you reach the present day!