Back to main site

sinablog

I don't even know

Fedi Pictures

November 26, 2018 — ~sinacutie

A few friends of mine are interested in removing themselves from Instagram, and I was asked to run a PixelFed instance. Unable to come up with a decent name, I chose something incredibly generic: fedi.pictures

Federation does not seem to be 100% yet, but this is 'good enough' for now, I think. Just needs a decent mobile app and we're good to go!

My account is @SinaCutie@fedi.pictures if you're interested in following. In my style, it will likely end up a mix of game and lewd. So be warned!

tags: pixelfed

Stream of thought rambling

November 09, 2018 — ~sinacutie

Migrating and merging two distinct sets of servers into one infrastructure was pretty neat. Luckily, the only "hard" part was mostly tedious, and that was merging two mail servers. Everything is now way more performant and costs me bundles less.

The server project I estimated to take five hours (what the fuck was I thinking, past me?). It ended up taking about 24 hours -- three full-time days. Despite my gross underestimation, the fact that I learned a lot really makes me feel like I came out of it winning.

I feel much better now that they're all on a more sane setup. And I can finally get back to my other projects!

Something I have been tinkering with is my own scrobbling system, since Last.fm is proprietary and Libre.fm is incredibly obtuse and stagnant. I have been designing this while in-between coding on my bot rewrite. Which, jumping tracks real quick, my rewrite is a fevered mess and badly needs refactoring. It has been a case of over-engineering everything. But it works, and that's all that matters at this point.

The reason I've been thinking heavily about both of these, is that I am due to start streaming again, and my bot is a humongous part of my shenanigans. And the scrobbling will enable me to easily log what is playing, so that people can ask the bot and/or I can display it on-screen. I already do this through grab-song, which I worked on for a while with aFoxNamedMorris.

Turns out that in my pile of code from the past, I have a framework for a scrobbler. I just need to make it fault-tolerant. I apparently made it so I can scrobble through my own API or have it piggyback on existing lastfm plugins, via modifying my /etc/hosts file... which is pretty standard procedure, as far as I know.

At least some of the ideas that past-me had weren't entirely bad.

(I really need to edit the CSS to have some more space between paragraphs...)

tags: rambling

That time I stole a friend's job

November 02, 2018 — ~sinacutie

For the last few days I've been doing almost non-stop programming, which has been freaking fantastic. I have missed doing this. My rewrite of MrSassBot, my multi-purpose sassing machine, is going much more quickly, since collaborating with a friend.

I have refactored so much that I am going to let $friend take the driver seat for a while. In my excitement to get things fully working at a base level, I stepped into the area they were working on, and I really want to let them do it.

At least the skeleton of this project is nearly finished.

Balls.

I need to sleep.

tags: python, sassbot

Oho, what's this?

October 29, 2018 — ~sinacutie

Hello, tilde.team~! Just fussin' about with this blog right now. :3

I have based my theme on ~ben's blog theme, but using the Dracula colour scheme.

tags: new-tilde

Check if external ip has changed

May 19, 2017 — ~sinacutie

Sometimes we are on connections that have a dynamic ip. This will add your current external ip to ~/.external-ip.

Each time the script is run, it will dig an OpenDNS resolver to grab your external ip. If it is different from what is in ~/.external-ip it will echo the new ip. Otherwise it will return nothing.

#!/bin/sh
# Check external IP for change
# Ideal for use in a cron job
#
# Usage: sh check-ext-ip.sh
#
# Returns: Nothing if the IP is same, or the new IP address
#          First run always returns current address
#
# Requires dig:
#    Debian/Ubuntu: apt install dnsutils
#    Solus: eopkg install bind-utils
#    CentOS/Fedora: yum install bind-utils
#
# by Sina Cutie <sina@cutie.space>
# Released under CC0

# Where we will store the external IP
EXT_IP="$HOME/.external-ip"

# Check if dig is installed
if [ "$(command -v dig)" = "" ]; then
    echo "This script requires 'dig' to run"

# Load distribution release information
    . /etc/os-release

    # Check for supported release; set proper package manager and package name
    if [ "$ID" = "debian" ] || [ "$ID" = "ubuntu" ]; then
        MGR="apt"
        PKG="dnsutils"
    elif [ "$ID" = "fedora" ] || [ "$ID" = "centos" ]; then
        MGR="yum"
        PKG="bind-utils"
    elif [ "$ID" = "solus" ]; then
        MGR="eopkg"
        PKG="bind-utils"
    else
        echo "Please consult your package manager for the correct package"
        exit 1
    fi

    # Will run if one of the above supported distributions was found
    echo "Installing $PKG ..."
    sudo "$MGR" install "$PKG"
fi

# We check our external IP directly from a DNS request
GET_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"

# Check if ~/.external-ip exists
if [ -f "$EXT_IP" ]; then
    # If the external ip is the same as the current ip
    if [ "$(cat "$EXT_IP")" = "$GET_IP" ]; then
        exit 0
    fi
# If it doesn't exist or is not the same, grab and save the current IP
else
    echo "$GET_IP" > "$EXT_IP"
fi

tags: shell script, linux

Setting up Samba on Solus

May 10, 2017 — ~sinacutie

Solus comes with Samba installed by default, as I am sure some other distributions do too. Last time I dealt with Samba, I wanted to gouge my eyes out, it was so complicatedly awful. This time, however, it was extremely simple by comparison.

If you're new to the command line, please remember that the dollar sign ($) is not part of the command. It denotes that I'm running as a regular user. (Root console has a hash mark (#) instead, on most default setups.)

First thing I needed to do was copy smb.conf to /etc/samba/smb.conf:

sh $ sudo cp /usr/share/defaults/samba/smb.conf /etc/samba/smb.conf

Originally, I had tried to create my Samba password before doing that, but it tossed a ton of errors. I ended up doing that as the last step.

Since I don't want Samba user to be the same as mine, I decided to use a different name. That user must also exist as a Linux user, so we have to first add that:

sh $ sudo useradd -s /sbin/nologin -m share

The command above creates the user "share" with a default home directory of /home/share and no shell, since it doesn't need to be able to log in via SSH.

Now we'll edit /etc/samba/smb.conf to include the location to our shared folder. I recommend adding this to the end of the file, though I added mine after the [homes] section:

ini [Share] comment = Share Folder path = /home/share browsable = yes read only = no

Since this is temporary and I plan on removing these things later, I did not bother commenting out the Printer section, which I usually do. I don't own a printer and there's no reason for it to try and share one. You can if you want; it's your configuration file, after all.

I ran testparm to make sure that there were no typoes. It checks the smb.conf for any errors:

```text $ sudo testparm Load smb config files from /usr/share/defaults/samba/smb.conf rlimitmax: increasing rlimitmax (10000) to minimum Windows limit (16384) Processing section "[homes]" Processing section "[homes]" Processing section "[share]" Loaded services file OK. Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions ```

If there are no errors, it should look similar to what's above. You can either press "enter" or "ctrl+c" — either is up to you.

Since everything is working as intended, we'll finally add the Samba password with smbpasswd before restarting Samba:

text $ sudo smbpasswd -a share New SMB password: Retype new SMB password: Added user share.

If all goes well, it should look like the above. Let's restart Samba, then test on a Windows computer:

sh $ sudo systemctl restart smb

Note: In Solus, the Samba daemon we went to restart is smb, but the name might vary between distributions.

On the Windows machine, I visited my computer by opening the file explorer and typing \\REMEDIOS in the address box, then pressed "enter." I was presented with the folder "share", and was able to log in with the username share and the password I set!

This is a very basic Samba setup, so I encourage you to check out the SambaWiki for more info.

tags: samba, solus, linux