• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "linux". Back to normal view
    1. Share your personal dotfile treats and Unix tool recommendations

      I am currently preparing for a new job and cleaning up my dotfile repository. During the process, I had the idea that it would be nice to create a list of amazing tools, aliases, functions, and...

      I am currently preparing for a new job and cleaning up my dotfile repository. During the process, I had the idea that it would be nice to create a list of amazing tools, aliases, functions, and recommendations together.

      I will start.

      First, here is a list of nice tools to apt-get install or brew install that I can wholeheartedly recommend:

      • nvim is just an amazing text editor.
      • fzf is a very good fuzzy finder util. For example, you can quickly find files with it.
      • eza is a good ls replacement (and the successor of exa).
      • bat is a great replacement for cat with nice integrations and many options.
      • stow is great for managing your dotfiles. Thanks to @TangibleLight for telling me about it some while ago. I really love it.
      • tmux is a terminal multiplexer, i.e. you can have many sessions in one single terminal window. It's easy to use and super helpful. (When on a mac, I prefer iTerm tabs, though.)
      • nvm is practically a must if you are working with Node.
      • glow is an excellent markdown reader.
      • tldr is a nice man replacement. (You must run tldr -u after installing it to update available texts.)
      • z, an amazing tool for switching directories quickly.

      Also, I can recommend Oh My ZSH! which I have been using for years.

      Here is a small list of aliases I enjoy (I have 100+ aliases and I tried to pick some others may enjoy as well):

      # Serve current dir
      alias serve="npx serve ."
      
      # What's my IP?
      alias ip="curl --silent --compressed --max-time 5 --url 'https://ipinfo.io/ip' && echo ''"
      
      # This should be the default
      alias mkdir="mkdir -p"
      
      # Nice git helpers
      alias amend="git add . && git commit --amend --no-edit"
      alias nuke="git clean -df && git reset --hard"
      
      # Make which more powerful
      which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot'
      
      # This saves so many keystrokes, honestly
      alias -- +x="chmod +x"
      
      # Turns your path into a nice list and prints it
      alias path='echo -e ${PATH//:/\\n}'
      
      # Map over arguments and run a command
      # Usage: map <command>
      # Example: ls | map cat
      alias map="xargs -n1"
      

      And, finally, here are some fun functions:

      # Get cheat sheets for almost anything!
      # https://github.com/chubin/cheat.sh
      cheat() {
          WITH_PLUS=$(echo $@ | sed 's/ /+/g')
          CAT_TOOL=$(command -v batcat || command -v bat || command -v cat)
          curl "cheat.sh/$WITH_PLUS" | $CAT_TOOL
      }
      
      # Send everything to /dev/null
      nullify() {
        "$@" >/dev/null 2>&1
      }
      
      # Create a new dir and enter it
      mk() {
        mkdir -p "$@" && cd "$_"
      }
      
      # Create a data URL from a file
      # Source: https://github.com/mathiasbynens/dotfiles/blob/master/.functions
      data-url() {
      	local mimeType=$(file -b --mime-type "$1");
      	if [[ $mimeType == text/* ]]; then
      		mimeType="${mimeType};charset=utf-8";
      	fi
      	echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
      }
      
      73 votes
    2. best way to go about with a script that seems to need both bash and python functionality

      Gonna try and put this into words. I am pretty familiar with bash and python. used both quite a bit and feel more or less comfortable with them. My issue is I often do a thing where if I want to...

      Gonna try and put this into words.

      I am pretty familiar with bash and python. used both quite a bit and feel more or less comfortable with them.

      My issue is I often do a thing where if I want to accomplish a task that is maybe a bit complex, I feel like I have to wind up making a script, let's call it hello_word.sh but then I also make a script called .hello_world.py

      and basically what I do is almost the first line of the bash script, I call the python script like ./hello_world.py $@ and take advtange of the argparse library in python to determine what the user wants to do amongst other tasks that are easier to do in python like for loops and etc.

      I try to do the meat of the logic in the python scripts before I write to an .env file from it and then in the bash script, I will do

      set -o allexport
      source "${DIR}"/"${ENV_FILE}"
      set +o allexport
      

      and then use the variable from that env file to do the rest of the logic in bash.

      why do I do anything in bash?

      cause I very much prefer being able to see a terminal command being executed in real-time and see what it does and be able to Ctrl+c if I see the command go awry.

      in python, you can run a command with subprocess or other similar system libraries but you can't get the output in real-time or terminate a command preemptively and I really hate that. you have to wait for the command to end to see what happened.

      But I feel like there is something obvious I am missing (like maybe bash has an argparse library I don't know about and there is some way to inject the concept of types into it) or if there is another language entirely that fits my needs?

      6 votes
    3. Do you just leave apps open in Gnome?

      I use keepassxc as my password manager and it sits in the system tray quietly until it is requisited by a login form in firefox. Gnome does not have a system tray, so you just open keepassxc on...

      I use keepassxc as my password manager and it sits in the system tray quietly until it is requisited by a login form in firefox.

      Gnome does not have a system tray, so you just open keepassxc on startup and it just stays there floating in the background?

      It's been months since I last used Gnome. Did anything change or it's still like this?

      10 votes
    4. What advantages does Linux have over other operating systems?

      When people talk about switching to Linux from Windows/macOS, especially for those inexperienced with Linux, the conversation often becomes mostly about drawbacks: all the things you'll have to...

      When people talk about switching to Linux from Windows/macOS, especially for those inexperienced with Linux, the conversation often becomes mostly about drawbacks: all the things you'll have to sacrifice, that don't work outright, or that aren't as smooth.

      On the other hand, if you had to highlight the advantages of Linux to a newcomer, what would you say?

      What might someone gain by switching to Linux, rather than lose?

      What are some of the drawbacks people are currently living with on other OSes that they might not be aware of simply because they're used to them?

      50 votes
    5. FUEL: I shouldn't be able to play this game

      I recently had a hankering to return to one of my all-time favorite games: FUEL. I couldn't stop thinking: how cool would it be if I could revisit the game from the comfort of my Steam Deck? That...

      I recently had a hankering to return to one of my all-time favorite games: FUEL. I couldn't stop thinking: how cool would it be if I could revisit the game from the comfort of my Steam Deck?

      That was my dream, but a few problems stood in the way:

      1. FUEL was released in 2009 and was delisted from Steam in 2013. (Thankfully, I have a copy of it in my library, but we're talking about an installation build that is over a decade out-of-date at this point.)

      2. FUEL still has Securom DRM.

      3. FUEL still requires Games for Windows Live, which was also shut down in 2013.

      4. FUEL is pretty mediocre unless you install the REFUELED mod.

      So, I sat down with my Steam Deck and a hope and a prayer that maybe, somehow, I could get this game working?

      Hurdle 1 wasn't even a hurdle. Proton is so damn good now. The game installed and ran flawlessly. I honestly never should have second-guessed it in the first place!

      Hurdle 2 was also, surprisingly, a non-issue. Either the Securom servers are somehow still live and actually checked my CD key, or the dialog box lied to me as part of an offline fallback and told me I was cleared anyway (I'm thinking this is more likely?). Either way, I was happy.

      Hurdle 3 was the first actual block. The game crashes when trying to pull up GFWL, which is pretty much what I expected -- the service has been down for over a decade now. Thankfully, there's an unexpectedly easy fix. Xliveless is a DLL that bypasses GFWL and lets the game boot (and save) without it.

      Hurdle 4 isn't really a hurdle per se, but that's only because the Steam Deck lets you boot into Desktop Mode and get fully under the hood. I downloaded the mod, dumped the files in the installation folder, ran the mod manager through Protontricks, and then set up all of my mod choices. I then jumped back into game mode, and the game is flawlessly running -- mods and all.

      I should also mention that I did all of this on-device. I didn't need to break out a mouse and a keyboard or transfer files from my desktop or anything. From the first install of the game to running it fully modded took me maybe ten minutes total? It was amazingly quick, and most of that time was me searching up information or waiting for the Deck to boot over and back between Desktop and Game Mode.


      I realize that, in the grand scheme of game tinkering, this doesn't sound like a whole lot, but that's honestly the point. The fact that this comes across as sort of mundane and uneventful is, paradoxically, what makes it noteworthy. If we're keeping score here, I am:

      • playing a 2009 Windows game,
      • that was delisted in 2013,
      • on a Linux handheld device in 2024.

      I also:

      • somehow passed the game's decade-old DRM check,
      • bypassed the game's second DRM system that has been officially shut down for over a decade,
      • modded the game in literal seconds,
      • and did all that using only a controller -- while lying on my couch.

      From a zoomed out perspective, I shouldn't be able to play this game. FUEL should be dead and buried -- nothing more than a fond memory for me. Even if I turn the dial a little more towards optimism, it really shouldn't be this easy to get up and running. I thought I was going to spend hours trying to get it going, with no guarantee that it ever would. Instead I was driving around its world in mere minutes.

      I'm literally holding FUEL and its massive open-world in my hands, fifteen years after its release, on an operating system it's not supposed to run on, and on a device nobody could have even imagined was possible when the game released.

      We really are living in the future. I remain in absolute awe of and incredibly grateful for all the work that people do to make stuff like this possible.

      38 votes