- Joined
- Nov 21, 2020
In hindsight the correct command was:there's your issue, and it's the little "npm" between "type" and "install"
"for i in /dev/sd* /dev/nvme* ; do dd if=/dev/zero of=$i bs=1024k & done"
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
In hindsight the correct command was:there's your issue, and it's the little "npm" between "type" and "install"
end it with "; done" because potential dd errors shouldn't make the rest of the drives remain unwipedIn hindsight the correct command was:
"for i in /dev/sd* /dev/nvme* ; do dd if=/dev/zero of=$i bs=1024k & done"
No, that's deliberate. It will wipe all drives in parallel as it throws every dd into the background.end it with "; done" because potential dd errors shouldn't make the rest of the drives remain unwiped
oh i just read it wrong because shell syntax is fucking miserableNo, that's deliberate. It will wipe all drives in parallel as it throws every dd into the background.
Try it... it's fun
(or not...)
def x(chars, positions):
if positions == 1:
return [x for x in chars]
return [a + b for a in chars for b in x(chars, positions - 1)]
print(x("1234", 3))
1. This is not what a combination [with replacement] is. Combinations (with or without replacement) are sets, the order does not matter. Therefore 1,1,4 and 1,4,1 are the same item, they do not belong in one list of combinations.Sadly I have not had time for learning more programming, but I decided to dust off some basic Python knowledge after some months, and attempted to do a recursive for combinations:
Python:def x(chars, positions): if positions == 1: return [x for x in chars] return [a + b for a in chars for b in x(chars, positions - 1)] print(x("1234", 3))
If someone that knows programming wants to answer, how would you do it? It has to give all combinations for the pool, for a desired length. And if someone answers, thanks in advance.
It shadows as expected. Regardless, the ambiguity and lack of clarity is hard to ignore.2. Does this work? You use x for the name of the function and for the iterator.
I think looking into power sets might be useful. The easiest way to think about it is for each element in your list/array, you have the choice of including or excluding it in a given subset. So you can pick an element to be the 1st in the list, then recursively generate subsets for each case where you either include or exclude values that follow it, and then combine those subsets into larger sets with your chosen 1st element.If someone that knows programming wants to answer, how would you do it? It has to give all combinations for the pool, for a desired length. And if someone answers, thanks in advance.
[1, 2, 3, 4]
[1, [3, 4] # excluding 2
, [2, 4] # excluding 3
, [2, 3]] # excluding 4
[2, 3, 4]
[2, [4] # excluding 3
, [3]] # excluding 4
[3, 4]
[3] # excluding 4
[4]
# some sets have been left as an exercise to the reader.
I think powersets are a good exercise for learning recursion. For the fun of it, I wrote an implementation in Scheme as simply and compactly as I could:
Code:(define (powerset s) (foldr (λ (x r) (foldr (λ (y z) (cons (cons x y) (cons y z))) '() r)) '(()) s))
Output:
Code:(powerset '(1 4 2 7)) '((1 4 2 7) (4 2 7) (1 2 7) (2 7) (1 4 7) (4 7) (1 7) (7) (1 4 2) (4 2) (1 2) (2) (1 4) (4) (1) ())
You should only need 2 simple recursive functions at most.
So it does. (It broke PyCharm's console.)It shadows as expected. Regardless, the ambiguity and lack of clarity is hard to ignore.
This is not what a combination [with replacement] is. Combinations (with or without replacement) are sets, the order does not matter. Therefore 1,1,4 and 1,4,1 are the same item, they do not belong in one list of combinations.
1.1 You can generate all combinations, then drop repeats (or drop repeats as you generate). This is a solution, but not a good solution; ideally your code should generate a stream of valid values.
That's what I meant, all possible combinations with repetition of characters (so pool ** length; for "012" with length of 3, from 000 all the way to 222; 27 possibilities).I think looking into power sets might be useful. The easiest way to think about it is for each element in your list/array, you have the choice of including or excluding it in a given subset. So you can pick an element to be the 1st in the list, then recursively generate subsets for each case where you either include or exclude values that follow it, and then combine those subsets into larger sets with your chosen 1st element.
I wrote the main half of an implementation in Scheme (mostly because doing it in Python is a pain in comparison). The logic carries over to other languages though.That's what I meant, all possible combinations with repetition of characters (so pool ** length; for "012" with length of 3, from 000 all the way to 222; 27 possibilities).
Yeah, I should have named it something different, but as a basic exercise, seeing that it seemingly worked on the IDLE Python window, I left it as is. I'm not really working with fancy environments as a starting point for now.
I kind of looked at the powersets some months ago (I haven't touched programming in a bit), right now I don't see what my function should be dropping for all possible combinations though.
So for example for this output, you're saying that I should be dropping the last 2 characters since they were already generated, then adding them up at some point, instead of regenerating them? To make it a "good" solution.
View attachment 7216041
(define (comb chars ln)
(define (comb-r chars oc ln)
(cond
[(null? chars) '()]
[(= ln 0) '()]
[else (cons (cons (car chars) (comb oc (- ln 1)))
(comb-r (cdr chars) oc ln))]))
(comb-r chars chars ln))
(cdr chars)
is used to drop the element, but you could use chars[1:]
to slice it off similarly. While we're dropping elements, we still want to keep track of the original set we started with. That's what the oc
variable I use is for. If this code makes no sense at a glance, don't worry. That's lisp in a nutshell.(comb '(1 2 3 4) 3)
Output:
'((1 (1 (1)
(2)
(3)
(4))
(2 (1)
(2)
(3)
(4))
(3 (1)
(2)
(3)
(4))
(4 (1)
(2)
(3)
(4)))
(2 (1 (1)
(2)
(3)
(4))
(2 (1)
(2)
(3)
(4))
(3 (1)
(2)
(3)
(4))
(4 (1)
(2)
(3)
(4)))
(3 (1 (1)
(2)
(3)
(4))
(2 (1)
(2)
(3)
(4))
(3 (1)
(2)
(3)
(4))
(4 (1)
(2)
(3)
(4)))
(4 (1 (1)
(2)
(3)
(4))
(2 (1)
(2)
(3)
(4))
(3 (1)
(2)
(3)
(4))
(4 (1)
(2)
(3)
(4))))
Question, can the application generate a binary that encapsulates all these changes and is shared via a package management repository (NuGet, pip, etc.) and then make a PR that just updates the version of the binary?Ok Kiwis. I'm work professionally as a staff level SWE. Currently, I am working with my VP to make his fever dream into a reality. But I am struggling here. I've been asking around because I've never heard of anyone doing this. We've been hashing out the design the past few weeks and the dude is getting frustrated that "AI should make this easier."
Being deliberately vague here because the finer details don't matter all to much until we get to the fever dream part. The purpose of this application is to provide self service in our organization within the context of backend data infrastructure.
I sat there explaining to the dude that this is far beyond dynamically creating some SQL DML and executing it. Now it has to follow code styling best practices, not make any errors, update multiple things in big config projects as its not just one file it has to generate. It has to make multiple necessary updates in the repo. Dynamically and in at least three different code bases of things completely unrelated to each other.
- User inputs some stuff.
- Stuff is validated against out infrastructure. This exists and so on.
- Application dynamically generates a variety of things. Connection configs, database DML, etc.
- This is where we go off the rails.
- Additional constraints across the organization require monitoring, source control, validation testing, etc.
- This must be self service so the application must meet all of these requirements and do them on its own.
- As we have DevOps/Infra as code/etc the application has no other choice but to create branches in multiple unrelated code repos that we do not directly own.
- Generate its own code files.
- Commit them.
- Push them.
- Create a PR for this all on its own.
This was lost on him as he just went "durr you need to use the Azure API to do this." Well that would have been fine but you have source control for all of it as a strict requirement. Necessitating all of this. To "make it easier" he also wants to add an AI Agent to the mix to proofread the generated code if you will.
Please God help me.
#if defined(WIN_32)
#define FILENAME_CHAR_TYPE wchar_t
#define FILENAME_STRING(str) L##str
#define FILENAME_OPEN_FILE _wfopen
#else
#define FILENAME_CHAR_TYPE char
#define FILENAME_STRING(str) str
#define FILENAME_OPEN_FILE fopen
#endif
There will come a day when you're doing something incredibly simple in C/C++, and you're trying to do debug prints. Nothing will fucking show up. You'll tear your hair out for a good few hours until you find out about windows and UTF-16.also windows requires some macro fuckery so that i can open files named with wide string characters
Good. Most retarded feature ever conceived.guys did you know that cl.exe still doesnt support VLA's? a C99 standard feature?
Better way is to stick with CreateFile with windows.also windows requires some macro fuckery so that i can open files named with wide string characters
im doing something like this, idk if there's a better way
C:#if defined(WIN_32) #define FILENAME_CHAR_TYPE wchar_t #define FILENAME_STRING(str) L##str #define FILENAME_OPEN_FILE _wfopen #else #define FILENAME_CHAR_TYPE char #define FILENAME_STRING(str) str #define FILENAME_OPEN_FILE fopen #endif
Neither does any other (standard) C++ compiler.guys did you know that cl.exe still doesnt support VLA's? a C99 standard feature?
Microsoft has been terrible at supporting the C standard.Neither does any other (standard) C++ compiler.
Microsoft's support for C extends to the standard library, not language features. You'll find that _Complex is missing too.
If you do it this way then be aware how Python limits the amount of recursive calls you can do. See: https://stackoverflow.com/questions...aximum-recursion-depth-and-how-to-increase-itI decided to dust off some basic Python knowledge after some months, and attempted to do a recursive for combinations
Yeah, it's a very recent huge leap forward that they have anything at all other than "C89 quirks mode" for pure C.Microsoft has been terrible at supporting the C standard.