Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)HA
Posts
17
Comments
99
Joined
2 yr. ago
  • thank you! your command worked like a charm once i prepended it with exec. i even added a final command taking me back to workspace 1. tested it with exec_always and it seems to be good, crossing fingers it will actually work on boot.

    maybe you can answer another question for me: is the config file executed asynchronously? What i mean is, does it run through each line, or is there a chance that, say, line 25 might execute before line 13?

  • Linux @programming.dev
    Hammerheart @programming.dev

    Help! My bash script isn't executing in my sway config

    I've been struggling with getting a wezterm window running cmus on a specific workspace upon start up for a while now. I can't use assign because the only eligible criteria differentiating it from a generic wezterm window is the pid, and my attempts to get the pid from get_tree and use that have been unsuccessful. I thought I had figured it out, when I put these lines in a another file:

     bash
        
    #! /bin/bash
    sway workspace 10 && sway 'exec wezterm -e cmus'
    
    
      

    then in my config file I have this: exec ./start_cmus.sh

    But it doesn't work. If I run start_cmus from the shell, the expected behavior ensues (a wezterm window running cmus is opened on workspace 10).

    Any tips?

    Print SF @lemmy.ca
    Hammerheart @programming.dev

    Just finished my first Zelazny (The Dream Master)

    I have to read more Zelazny after this. I was struck by two things in particular: The surprising playful quality of the prose. He has little vignettes dispersed among the main narrative, and it gave me the sense that Zelazny was having a lot of fun while writing this book. It was kind of refreshing after reading so many other self-seriously, rigidly constructed novels. It gave me a feeling similar to the ones I experience when I listen to some experimental music, where the process is not treated as a mere necessary evil on the way to the finish product.

    The second thing was struck a chord was the ending. I liked how it was all show and no tell, which I wasn't expecting. It was kind of creepy, and very intense. I wasn't expecting such a visceral end to a book which, until then, had been rather laid back.

    Now that I've finished it, I feel like it was very dense, thematically. I suspect I will revisit it and gleam many meanings which I missed this time.

    I would like to open the thread

  • The jank is kind of severe, but I like what they're trying to do. Still, I keep meaning to make a bug report, because I cant right click on the tab bare without the browser crashing more than half the time.

  • I think the default mod key is the 'super' key (formerly known as the windows key). It might be alt actually, I don't remember. Super + 1-9 switches between workspaces, which hold your windows. Shift + super + 1-9 moves a window to another workspace. you can find more key bindings by viewing $XDG_CONFIG_HOME/sway/config (or wherever config files go on your system).

  • Advent Of Code @programming.dev
    Hammerheart @programming.dev

    Question (mostly about grep and rg)

    So this is really kind of tangential, I am just messing around with the data and trying to at least nail down some basics so I can do sanity checks in my actual code. I am running into an odd discrepancy when trying to determine the number of times "XMAS" occurs in the input. I am only concerned with the straight forward matches, the instances of the substring "XMAS" appearing in the raw data.

    When i do "grep -c XMAS input" or "rg -c XMAS input" they both show 107. But when I use regex101.com and search for the pattern XMAS, it shows 191 matches. Please help, I am truly at a loss here. While writing this, it occurred to me to just try using string.count("XMAS") in python on the data as a raw string, and it also returns 191. So really this question is more about grep and rp than anything. why are they only returning 107?

    Python @programming.dev
    Hammerheart @programming.dev

    First time using the walrus operator!

    I am working on a rudimentary Breakout clone, and I was doing the wall collision. I have a function that I initially treated as a Boolean, but I changed it to return a different value depending on which wall the ball hit. I used the walrus operator to capture this value while still treating the function like a bool. I probably could have just defined a variable as the function's return value, then used it in an if statement. But it felt good to use this new thing I'd only heard about, and didn't really understand what it did. I was honestly kind of surprised when it actually worked like I was expecting it to! Pretty cool.

  • For real. The main reason I switched to linux was because I was getting into progamming, and when I had to troubleshoot something on windows it was like half a dozen arcane solutions which might work, but the linux solution to the same problem was a terminal one liner. Maybe I'd feel differently if I was afraid of the terminal, but that's one affliction I am blessedly free of.

  • Idk, I still think information wants to be free. If you figured it out just farting around, sophisticated malevolent actors are likely already doing similar things. Might be better to let the genie out of the bottle, so people can learn to be skeptical. Deep fakes are optimally effective when a majority still accepts the veracity of images as an article of faith.

  • Linux @programming.dev
    Hammerheart @programming.dev

    Uber simple FOSS video editing software

    All I want to do is put a still image over a MP3 so I can upload a song to Youtube. (Sidenote: It feels really good to find a song I want to show someone that isn't already on Youtube. It used to be a somewhat regular thing i'd do, I have about a dozen Youtube videos that are just songs I uploaded because I wanted to show them to someone, but I guess Youtube got more stuff and my taste got more pedestrian, so I haven't felt the need to do it until now. Feels good!)

    I used VEED, a web editor, and it produced a >300mb file. That seems a bit excessive. For the curious, this is the song: https://youtu.be/iLz7VXhCrnk

    Python @programming.dev
    Hammerheart @programming.dev

    Can I get some feedback / review on my code?

    I started working through the 100 Days of Code course of Udemy last February, and I'm in the home stretch. I'm on the final lessons, which are really just prompts for projects. No hand holding, just a brief description of the goal. I recently finished a tkinter GUI program, the goal of which was to enable adding text watermarks.

    I took a few liberties--mainly, I made it possible to layer a png on top of the background. It was a really fun project and quickly grew more complicated than I expected it to. I got some hands on experience with the Single Responsibility Principle, as I started off doing everything in my Layout class.

    Eventually, I moved all the stuff that actually involved manipulating the Image objects to an ImageManager class. I feel like I could have gotten even more granular. That's one thing I would love to get some feedback on. How would a more experienced programmer have architected this program?

    Anyway, I guess this preamble is long enough. I'm going to leave a li

    Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ @lemmy.dbzer0.com
    Hammerheart @programming.dev

    Installing and using Jellyfin without root

    cross-posted from: https://programming.dev/post/14680192

    I have a VPS, but no root access so I can't use apt, or even read a lot of the system files. I would like to get jellyfin (or any media server, really) running on it. Jellyfin has a portable installation option, so I followed the instructions in the docs to install it from the .tar.gz.

    But it says I have to install ffmpeg-jellyfin, and I can't find a portable installation of that. My VPS already has ffmpeg installed on it. Will jellyfin work if I just point it to that instead? Or, how can I go about installing ffmpeg-jellyfin without root access?

    Linux @lemmy.ml
    Hammerheart @programming.dev

    Installing and using Jellyfin without root

    I have a VPS, but no root access so I can't use apt, or even read a lot of the system files. I would like to get jellyfin (or any media server, really) running on it. Jellyfin has a portable installation option, so I followed the instructions in the docs to install it from the .tar.gz.

    But it says I have to install ffmpeg-jellyfin, and I can't find a portable installation of that. My VPS already has ffmpeg installed on it. Will jellyfin work if I just point it to that instead? Or, how can I go about installing ffmpeg-jellyfin without root access?

    Learn Programming @programming.dev
    Hammerheart @programming.dev

    Weird behavior in python (tkinter)

    I'm working on a little gui app that will eventually (hopefully) add a watermark to a photo. But right now I'm focused on just messing around with tkinter and trying to get some basic functionality down.

    I've managed to display an image. Now I want to change the image to whatever is in the Entry widget (ideally, the user would put an absolute path to an image and nothing else). When I click the button, it makes the image disappear. I made it also create a plain text label to see if that would show up. It did.

    Okay, time to break out the big guns. Add a breakpoint. py -m pdb main.py. it works. wtf?

     python
        
    def change_image():
        new_image = Image.open(image_path.get()).resize((480, 270))
        new_tk_image = ImageTk.PhotoImage(new_image)
        test_image_label.configure(image=new_tk_image)
        breakpoint()
    
      

    with the breakpoint, the button that calls change_image works as expected. But without the breakpoint, it just makes the original image disappear. Please help me understand w

    Linux @lemmy.ml
    Hammerheart @programming.dev

    How to see CMUS logs / get info for bug reports

    Sometimes my CMUS will randomly stop playing a track or it won't play the next track until I manually go in and hit c (for resume) or otherwise initiate playback. I would like to be able to see what happened before these instances so i could either fix my config or, if its a problem beyond the scope of my local environment, get info to write up a proper bug report with. Where can I find such logs? Would they be in the systemd journal or somewhere in /var ?

    Neovim @programming.dev
    Hammerheart @programming.dev

    :s/ failed to find the ^M s

    So I just had an issue where my shebang lines weren't parsing properly for a python script I was attempting to execute. A quick google revealed that it was probably because I wrote the scripts on windows and now I was trying to run them on Linux (so happy i finally made the switch btw. using the computer is fun again!). So i took the advice I found and tried to run :%s/^M/ (using C-v, C-m to insert the escape character), and it failed to find any matches. I tried the same command in vanilla vi and it worked.

    Is there some setting I don't have configured properly? I would prefer to be able to do this sort of thing within neovim.

    Linux @lemmy.ml
    Hammerheart @programming.dev

    Xclip is not talking to the system clipboard (Klipper)

    If anyone could help me out with this, I'd greatly appreciate it. Basically, I can't ctrl + v to paste anything I pipe into the clipboard selection in xclip, and i can't xclip -o anything I copied with ctrl-c or ctrl-shift-c.

    Maybe I want to paste a path into a neovim file. echo $(pwd) | xclip -i -sel c Now the path is in my clipboard, right? It sure shows up if i xclip -o -sel c!

    But when I go into neovim and paste from the unnamedplus register, instead it pastes the last thing I copied in my browser.

    if I want to copy the output of something from my terminal and google it, ctrl+v in the browser completely ignores my xclip selection.

    i am forced to use the mouse and ctrl+shift+c in order to paste it into a search engine, like a caveman.

    I hope I've done a decent enough job explaining the problem. It was most apparent earlier, as I was making a cronjob and I had to be explicit about file paths because i couldn't assume the working directory would be the directory of the sc

    Linux @lemmy.ml
    Hammerheart @programming.dev

    I feel like breaking my windows install was a rite of passage

    Lately ive noticed that i was wanting to do certain things on Windows that just seemed much easier and more intuitive on Linux, based in the OS specific solutions i would see to problems i encountered. And i was more frequently using software where Windows support seemed like an after thought.

    A couple days ago i finally sat down and tried to install Mint. The installer didnt recognize my windows partition so it didnt offer any assistance. And a stroke of fate saw my internet connection dieing at the exact same time. Yes, i cant believe it either.

    So i decided to live dangerously and just try to wing the installation with no outside help. It seems like creating a second EFI partition was not the right call. The install failed, and I couldn't get back onto windows.

    I wound up just using a live ubuntu image for a few days while i wrestled with repairing the boot loader. I didnt succeed. Eventually i just made a windows recovery disk from my Desktop with an intact copy of windows, and

    Neovim @programming.dev
    Hammerheart @programming.dev

    UndoTree Plugin Not Working

    I'm new to vim and getting the hang of the configuration. I've gone through a couple of youtube videos giving a tutorial of setting it up with lazy.nvim. Now I am following ThePrimeagen's config, and UndoTree doesn't work.

    The plugin is loaded and my config is properly sourced, but when I run run :UndoTreeToggle, I get this lovely error:

    (E5108: Error executing lua: function undotree#UndotreeToggle[11]..<SNR>37_new[2]..41, line 6: Vim(echoerr):"diff" is not executable. stack traceback: [C]: at 0x7ff77ae89570)

    I am running windows (currenty in the process of backing up my personal data so I can try out Linux without feeling too disconnected from my daily computer user). I did a little bit of google searching and checked the issues on github, unfortunately I couldn't find anything related to my problem. Any help would be much appreciated.

    Learn Programming @programming.dev
    Hammerheart @programming.dev

    Why am I getting this unexpected arguments warning in python?

    I am working on user authentication in Flask. I have my User class, which inherits from db.Model (SQLAlchemy) and UserMixins (flask-login):

     python
        
    class User(db.Model, UserMixin):
        id = db.Column(db.Integer, primary_key=True)
        email = db.Column(db.String(100), unique=True)
        password = db.Column(db.String(100))
        name = db.Column(db.String(1000))
    
    
      

    and I create a new User object during registration:

     python
        
            new_user = User(
                name=request.form["name"],
                password=generate_password_hash(password=request.form.get("password"),
                                                salt_length=8,
                                                method="pbkdf2:sha256"),
                email=request.form["email"])
    
    
      

    Since I inherited from UserMixins, I started to get an "unexpected arguments" warning from pycharm when I create new_user. can someone explain to me why that is? If I don't inherit from UserMixins, the warning goes away.

    Programming.dev Meta @programming.dev
    Hammerheart @programming.dev

    I can't log into pd in jerboa?

    So, it used to work just fine. Then jerboa became basically unusable due to some bug. That was a few weeks ago. I saw an update was available, so I thought to give it another try. It's much more stable after the update, and my lemmy.one account works just fine. But when I try to log in with this account on jerboa, I get an incorrect login error. I set the instance to "programming.dev" and I know I used the right credentials because my password manager filled them in, just like it does in the browser.

    Any ideas on a cause or fix? It might be a jerboa issue but I don't get why it seems to only impact this instance.

    C Programming Language @programming.dev
    Hammerheart @programming.dev

    I made my first C program!

    I was looking over the first kata i did on codewars, and I thought it would be fun to try and solve it in C. The object was to return a string based on a boolean input. it took a lot of trial and error, googling, chat gippity, but I eventually got it to work. I am still focused on learning python, but I've had it in my mind that I should branch out once I've reached a competence plateau in python. I'm nowhere near that plateau yet, but this seemed simple enough to warrant the necessary investment in time to accomplish it.

     undefined
        
    // C:
    #include <stdbool.h>
    // FIRST EVER C PROGRAM
    const char *bool_to_word (bool value){
    // you can return a static/global string or a string literal
      if (value == 1){
      return "Yes";
        }
      else{
        return "No";
      }
    }
    
      

    I realize this is pretty trivial, but still, it's a milestone for me and I wanted to do my part to get the ball rolling on this community.