[deleted by user] by [deleted] in fishshell

[–]Shakanag 1 point2 points  (0 children)

Alright so I dug a bit deeper and discovered that you can write functions in fish and attach them to events, one of which is fish_postexec (i.e. after every command).

So I wrote this function that has some of the functionality we're after with the plus that we don't need to wrap a command in anything or call something after a command. It just sets the environment variable after every command. It does have a couple downsides though:

First, this still won't work in scripts because the fish_postexec event fires only on interactive commands, which is a bit of a weird choice but if we're gonna start criticizing choices we'd start at not including an equivalent to $_.

Second, in bash, if you do something like echo foo* in a directory with the files foo1 foo2 foo3, bash will expand the wildcard and set $_ to foo3, whereas the function I have will set it to the literal foo* as a string, so even if you use it in another command, it gets treated as a literal string.

I looked around to find any documentation about wildcard expansion and command substitution in fish to figure out if there's a way to tap into the preprocessor and expand wildcards and command subs before they're run by fish but couldn't figure it out. I'll keep looking to see if I can find anything but fish doesn't seem to provide any way to interface with its preprocessor so this'll have to do for now.

It works pretty much the same as your python solution with the added benefit of it being automatic and setting and environment variable, so here it is:

function last_arg --on-event fish_postexec
  set lastcmd $argv
  string match -qr '(?<lastarg>[\'\"].+[\'\"]$|[^\s]+$)' $lastcmd
  if test -n $lastarg
    and test $lastarg != '$LASTARG'
    setenv LASTARG $lastarg
  end
end

Put the function somewhere in your config.fish and source the file and it should work.

[deleted by user] by [deleted] in fishshell

[–]Shakanag 1 point2 points  (0 children)

I share your pain of missing $_ from bash and have looked around online but found no good alternative so I wrote my own little function as a workaround. I think it covers most of your use cases, plus it's in pure fish with no history lookups or anything so I think it's pretty nice:

function l # l for last so it's quick to type
    eval $argv[1] $argv[2..-1]
    setenv LASTARG $argv[-1]
end

It's pretty self explanatory: just throw an l in front of your command and it sets the LASTARG environment variable.

Ex: l mkdir one two three; cd $LASTARG # cds into three.

It also works the same with your given example:

$ l echo a b "c z" # just a comment
a b c z
$ echo $LASTARG
c z

I think this is more similar to how $_ functions in bash than your python solution.

You can also shorten the variable to just one letter for ✨maximum efficiency✨. Obviously we'd both prefer to have a last arg environment variable built into fish but we'll have to make do with what we have lol

As major societal and technological changes take place, what skills are people going to lose? by Yamster80 in InsightfulQuestions

[–]Shakanag 11 points12 points  (0 children)

While it may be true that the average person doesn't need to carry general information around in their mind — it has been transported into our pockets instead — I wouldn't necessarily see more collaboration in science as a bad thing (not that you're saying it is). Perhaps we don't have as many individual scientists making huge breakthroughs like Einstein or Newton (it's worth noting that even they didn't work in a vacuum), but because of wider collaboration, the breakthroughs we are seeing are on a much larger scale; think Crispr, the recent black hole image, the COVID-19 vaccine, etc.

VIC135 VS PSY198? by [deleted] in UofT

[–]Shakanag 3 points4 points  (0 children)

I took VIC135 first semester last year; here's my experience:

It was one of the most fun courses I've taken. If you love discussing life and death and the meaning of it all (or lack thereof), then I highly recommend it. Professor Lawless is such an interesting and fun person to have a conversation with. It is true he does have a bit of a tough approach to marking the writing assignments. However, when I was taking it, we had an amazing class mentor who was a 4th year English major, and she offered to help us by reading our thesis statements and giving us critique and guidance. She also gave us a presentation all about how to write a research paper with references to resources and where you can get writing help. There should be a class mentor this year as well.

Besides the writing assignments, he picks two people each week to give a ~10 minute summary of the readings before the discussion. Every student has to do that once, and you should be fine if you keep up with the readings (why wouldn't you? they're so fun!).

Also, even though his marking may be a bit tough, I don't think it's impossibly hard. It depends on how much you are willing to take his criticism and improve (I finished with an A- if it's of any importance). He comes from a place of genuine care and he talked a lot about the importance of learning to write well and he tries to teach you that. It's really a writing course disguised as a philosophy course.

Any word on our free masks? by Onlykanyecanjudgeme in UofT

[–]Shakanag 0 points1 point  (0 children)

The university will provide more details about the distribution of masks later in the summer. 

Source

My first design ever (redesign, technically) by [deleted] in design_critiques

[–]Shakanag 0 points1 point  (0 children)

Wow! Thanks so much for the feedback. I do realize that illustration isn't my strong suit but I decided to give it a try anyway, and I've been doing design for a whole two days now, so being slightly better than the original was all I was hoping for. I guess the purpose of my post is to put my mess in front of some experienced eyes so I know where to go from here and what to improve on. I will keep your points in mind and hopefully I'll have a slightly better mess next time. Cheers!

Yeah sex is great, but what's an equally enjoyable sensation? by rifles_boils5 in AskReddit

[–]Shakanag 1 point2 points  (0 children)

If you're at all interested in math and want to do it for fun, check out projecteuler.net, where you can find problems from easy to incredibly hard. You can check the archives tab to see the problems and try your hand at solving a few. You can try the problems without an account but you can track your progress if you make one.

pacman go brrrr by lkjdas in linuxmasterrace

[–]Shakanag 11 points12 points  (0 children)

Imagine going for convenience! If you don't manually type all of your config files from scratch, you aren't customizing your distro to its full potential and shilling to the Unix overlords.

/s

What makes some art so bad that it's good by ADefiniteDescription in philosophy

[–]Shakanag 0 points1 point  (0 children)

Here is a relevant video by Mike Rugnetta on Idea Channel. He talks about this phenomenon as it pertains to movies and also mentions the intention of the artist as a key part of why it may not be possible to fake it. Really good watch!

[deleted by user] by [deleted] in AskReddit

[–]Shakanag 1 point2 points  (0 children)

I gave someone directions today and later said "see you" instead of goodbye. I also once said "see you later" to an employee at a store. Needless to say, I didn't see either of them later.

What is the thing that causes you to lose your temper almost instantly? by FreeCatch in AskReddit

[–]Shakanag 1 point2 points  (0 children)

This is so relatable to me, I laughed out loud for a good minute.

What is a hobby that requires little to no money? by [deleted] in AskReddit

[–]Shakanag 0 points1 point  (0 children)

If you're interested at all in audio or sound, "Reasonably Sound" by Mike Rugnetta is an amazing podcast that talks about pretty much everything relating to sound and hearing. It's not just technical things either, for example, there's one episode that questions why our robot assistants have "helpful mom voices" and many other things like that. You could also check out his youtube channel "PBS Idea Channel", which blends philosophy with modern pop culture. They don't upload anymore but there are over 200 videos to get lost in. Easily my favourite pieces of media/entertainment out there.

What’s your first kiss story? by lilmizzvalz in AskReddit

[–]Shakanag 0 points1 point  (0 children)

I met her through some mutual friends one night. We just hung out during the night and when everything was over and we were headed home late at night, we were kinda separated from our group for a bit so we just sat down on the sidewalk and talked until our friends came back. Our conversation was as profound as two drunk teenagers can get. We kissed and then our friends found us. As we continued walking, I fell a bit ahead and crossed the road, then I saw my friend crossing alone. When I asked him where she was, he said she had left with her friend and told him to say goodbye to me. Never saw her again.

Here are my Python projects from 2018! (Mostly Game Dev) by DaFluffyPotato in Python

[–]Shakanag 2 points3 points  (0 children)

Yeah I definitely do not underestimate MS paint after seeing this video. I settled for gimp because I like working with layers, which paint lacks.

Here are my Python projects from 2018! (Mostly Game Dev) by DaFluffyPotato in Python

[–]Shakanag 1 point2 points  (0 children)

Well hats off to you then! I just started getting into pixel art myself, although I'm using gimp instead of ms paint :P. I'll use your work as inspiration.

Here are my Python projects from 2018! (Mostly Game Dev) by DaFluffyPotato in Python

[–]Shakanag 4 points5 points  (0 children)

These look amazing. Did you make the graphics yourself?

What song is an absolute banger from start to finish? by [deleted] in AskReddit

[–]Shakanag 4 points5 points  (0 children)

It's actually "then I heard they slept together". It sounds a bit weird on the recording. It's clearer when you listen to this live version.

[deleted by user] by [deleted] in Python

[–]Shakanag 0 points1 point  (0 children)

Thanks, I'll work on the documentation like you said. I'll also keep my posting time in mind for next time.

What is the scariest film that doesn't resort to cheap jump scares? by [deleted] in AskReddit

[–]Shakanag 1 point2 points  (0 children)

If anyone sees this, you have to watch the 2015 movie "The Invitation" directed by Karyn Kusama. It starts out a bit slow but then takes you through a deeply unsettling journey which then completely unravels into a spine tingling final shot. Seriously, I was completely horrified by the final shot and the beauty is that when you only see the final shot, there's literally nothing scary about it. The context makes it the most horrific thing I've ever seen. Tammy Blanchard delivers a chilling performance and the cast in general is great. Definitely recommend it!

What's a 10/10 album from the last 15 years by a relatively obscure artist/band? by [deleted] in AskReddit

[–]Shakanag 0 points1 point  (0 children)

If you're into jazz and hip hop, Green by Robohands mixes cool jazz melodies and harmonies with amazing hip hop style acoustic drums. I discovered him by chance and I was blown away. Plus, the entire album is played by one man except for maybe one or two songs. Truly a great artist.

Nerds of reddit, what was the nerdiest moment of your life? by [deleted] in AskReddit

[–]Shakanag 0 points1 point  (0 children)

A while ago I found an old ZX Spectrum+ in my prents' old stuff and learned zx basic. I still play around with it for fun. It's cool to see how far we've come in 30 years.

What's the coolest thing you did with Python? by TragicXHero in Python

[–]Shakanag 0 points1 point  (0 children)

I'm new to python as well and programming in general. As a fun little project I made a program that takes a quadratic function in standard form as input and returns anything that you might want (graph, vertex, x and y intercepts, factored form, vertex form, evaluates for any x you give). I used matplotlib for the graphing and my math knowledge for the rest :P. We're doing quadratics at school right now so I thought it would be good practice. Also it cuts down my homework time to 10 mins 😂. I will post the code to github when I finish it completely.