Show newer

@twee@patch.cx @mngrif I just use a cheap lavolere from Amazon. I can look it up. Or sometimes the built-in one on the LG phone that I was using. I bought a dedicated camera and haven't made a vid since.

@billstclair@kiwifarms.cc @billstclair@gab.com

youtube.com/watch?v=O2iGMYeZb9

Now it is, but it was designed by IMI and from '82 to '05 it was made by IMI and from '05-09 was a joint thing between IMI and MR.. And since 2009 it is made by MR. And GD made it between 95-98.

en.wikipedia.org/wiki/Desert_E

@billstclair I think the specific lyric is "...And a Desert Eagle that's one great big ol' pistol
I mean .50 caliber made by badass Hebrews" only thing I know by IMI that is mentioned in a song :)

@billstclair ever listen to the song Chocta Bingo by Ray Wylie Hubbard? There's a line in it about the Desert Eagle.

Second Freebie!!! This one is marked as "easy"

This problem was asked by Google.

Given two singly linked lists that intersect at some point, find the intersecting node. The lists are non-cyclical.

For example, given A = 3 -> 7 -> 8 -> 10 and B = 99 -> 1 -> 8 -> 10, return the node with value 8.

In this example, assume nodes with the same value are the exact same node objects.

Do this in O(M + N) time (where M and N are the lengths of the lists) and constant space.

Freebie!! Here you go!
This problem was asked by Facebook.

A builder is looking to build a row of N houses that can be of K different colors. He has a goal of minimizing cost while ensuring that no two neighboring houses are of the same color.

Given an N by K matrix where the nth row and kth column represents the cost to build the nth house with kth color, return the minimum cost which achieves this goal.

Solution (with caveat) 

@khird so I tried it in a new terminal window and it works. I tried it in the previous window and it still does it without the /'s funny that, but meh, almost with I could do that on purpose. But, anyway it works. Well done!

Solution (with caveat) 

@khird interestnig, it works at work, on 5.0.3 I will have to check the laptop again when I get home.

Consider this:
echo "${TEMP#${TEMP%/*/*/*}/}"

Solution (with caveat) 

@khird is that possible within the constraints?

Solution (with caveat) 

@khird I just typed this in and got this:

$ TEMP="/head/shoulders/knees/and/toes/eyes/ears/mouth"
$ echo ${TEMP#${TEMP%%+([^/])/+([^/])/+([^/])}}
eyes ears mouth

Solution (with caveat) 

@khird
That gives the final path without any '/' at all ..

You were closer with the previous one

Here's a freebie. They labeled it as "Hard"

This problem was asked by Google.

Suppose we represent our file system by a string in the following manner:

The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents:

dir
subdir1
subdir2
file.ext
The directory dir contains an empty sub-directory subdir1 and a sub-directory subdir2 containing a file file.ext.

The string "dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2\n\t\t\tfile2.ext" represents:

dir
subdir1
file1.ext
subsubdir1
subdir2
subsubdir2
file2.ext
The directory dir contains two sub-directories subdir1 and subdir2. subdir1 contains a file file1.ext and an empty second-level sub-directory subsubdir1. subdir2 contains a second-level sub-directory subsubdir2 containing a file file2.ext.

We are interested in finding the longest (number of characters) absolute path to a file within our file system. For example, in the second example above, the longest absolute path is "dir/subdir2/subsubdir2/file2.ext", and its length is 32 (not including the double quotes).

Given a string representing the file system in the above format, return the length of the longest absolute path to a file in the abstracted file system. If there is no file in the system, return 0.

Note:

The name of a file contains at least a period and an extension.

The name of a directory or sub-directory will not contain a period.

Solution (with caveat) 

@khird you know the name of the variable because you are working with it... I think the original problem was based on something like

for I in $(ls SOMETHING) ; do SOMETHING with ${I <stuf>)

I just stored a bunch of crap in the $TEMP variable to play with it and not make the problem too complex.

Solution (with caveat) 

@khird close but that one still has the leading / on the output. Also, I don't think you need **, * will be sufficient. You are close :)

@sptnkmmnt well, I tried what I know. I don't really have much conversational Russian. But I figure I could try to say hi :)

Okay, this is a big one (description-wise) but basically the idea is to build a Monte Carlo simulation craps simulator to observe strategic differences between "Pass", "Don't Pass", with and without odds.

Here is a description of the necessary craps rules. Ask whatever questions that I haven't made clear.
git.qoto.org/Absinthe/crapssim

This one is super free! It is not a programming problem so much as a BASH problem.

Using bash parameter expansion only gnu.org/software/bash/manual/h

Given an arbitrarily long path, such as "/head/shoulders/knees/and/toes/eyes/ears/mouth" stored in a variable $TEMP construct a parameter expansion to render only the last two subdirectory and filename like "eyes/ears/mouth" such that you can simply offer the command "echo ${TEMP<stuff goes in here>}"

And yes I do know how much easier it is to do with grep, sed, python, perl, awk <insert your favorite alternate solution here> can do it better and easier. This is a real world problem, and someone on Reddit pointed me in the right direction.

Show older
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.