10 print "The answer is 42"
20 goto 10
20 goto 10
Question: Write some c code to iterate through /etc/passwd listing
all accounts with UID >= 1000.
The answer:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <sys/types.h>
#include <pwd.h>
int main() {
struct passwd *pwd;
setpwent(); // set the file pointer to the beginning of /etc/passwd
while ((pwd = getpwent()) != NULL) {
if (pwd->pw_uid >= 1000) {
printf("Username: %s, UID: %d\n", pwd->pw_name, pwd->pw_uid);
}
}
endpwent(); // close /etc/passwd file
return 0;
}
Question: write a shell script to list users in /etc/password
with UID >= 1000.
Answer:
#!/bin/bash
awk -F: '{if (($3 >= 1000)) print $1}' /etc/passwd
Question: write an ansible play to install rsync on
red hat linux
Answer:
---
- name: Install rsync on Red Hat Linux
hosts: all
become: yes
tasks:
- name: Update apt cache
package:
name: epel-release
state: present
- name: Install rsync
package:
name: rsync
state: present
---
- name: Print user accounts with UID >= 1000
hosts: all
tasks:
- name: Get user accounts
getent:
database: passwd
register: passwd_output
- name: Filter users with UID >= 1000
debug:
msg: "{{ item }}"
loop: "{{ passwd_output.stdout_lines }}"
when: item.split(':')[2] | int >= 1000
These are pretty cool examples. Thanks for sharing.Here are three questions I asked at $JOB (because we were discussing it today). The answers were pretty good.
Code:Question: Write some c code to iterate through /etc/passwd listing all accounts with UID >= 1000. The answer: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <sys/types.h> #include <pwd.h> int main() { struct passwd *pwd; setpwent(); // set the file pointer to the beginning of /etc/passwd while ((pwd = getpwent()) != NULL) { if (pwd->pw_uid >= 1000) { printf("Username: %s, UID: %d\n", pwd->pw_name, pwd->pw_uid); } } endpwent(); // close /etc/passwd file return 0; }
This is fair. Not great, just ok.
Code:Question: write a shell script to list users in /etc/password with UID >= 1000. Answer: #!/bin/bash awk -F: '{if (($3 >= 1000)) print $1}' /etc/passwd
This example is not that good. I would have written it as:
awk -F: '$3 >= 1000 {print $1}' /etc/passwd
This last answer was not so good. rsync is not in EPEL and
I'm not sure what "apt" has to do with RHEL.
Code:Question: write an ansible play to install rsync on red hat linux Answer: --- - name: Install rsync on Red Hat Linux hosts: all become: yes tasks: - name: Update apt cache package: name: epel-release state: present - name: Install rsync package: name: rsync state: present
Yeah, it may not be great but it will probably become better over time.
Its an old dream.
reduce the cost of production and increase profits
only for Siri to file a patent infringement lawsuit and ask Alexa to be the lawyerI hope they sort out Bing's homicidal urges before they connect it to arms and legs.
Dude, do not use voice recognition to write your posts...Lettuce not forget the broad shoulders that some of us stand (or sit) upon.
Not possible. These things have the same problem humans have, they fantasize facts into "existence" but then fail to realize and correct this. Some humans fail at this, also. There is a reason we have safeguards against one dude pushing "the button". Handing anything over to AI is equal to have your 4yr old drive your car. Maybe that works on a sunny day on a free road, but have them do that in a winter blizzard with other rushhour rat-racers who want to be home in time for the game but very carefully at the same time. That's when I look for a quiet parking spot and wait for an hour or so. Not possible with armed AI, sadly.I hope they sort out Bing's homicidal urges before they connect it to arms and legs.
Given how people treat the Tesla Autopilot, for now it only helps them doing a self-delete.So your theory is that the only possible embodied AIs are homicidal ones?That is actually a super cool theory.
In seriousness, it's obvious AI is going to kill some people at some stage. But does it have to be a spree?
It's no secret that Uncle Sam has just such a button, but the counterbalance to it are two countries: One has the most people, the other has the most land.There is a reason we have safeguards against one dude pushing "the button"
Unfortunately, yes. Government usually steps in to protect the population against a problem that, left unmitigated, would accelerate population loss.So your theory is that the only possible embodied AIs are homicidal ones?That is actually a super cool theory.
In seriousness, it's obvious AI is going to kill some people at some stage. But does it have to be a spree?
Not exactly a button. They have a president* in chief that may issue an order and at least 3 people who would need to take that serious. The same goes for at least one, of the other examples you mentioned. The biggest danger I see here is that some bright (ahem) government attempts to replace these safeguard persons with AI. Because, what could go wrong?It's no secret that Uncle Sam has just such a button, but the counterbalance to it are two countries: One has the most people, the other has the most land.
For outdated medications, those are cheap and easy to replace, and CDC recommends keeping those up to date... But not following that CDC recommendation is gonna result in significantly less harm than not following the protocol of missile launch... SMH...A friend of mine used to be an officer in US missile submarines. He was the officer in charge of the propulsion reactor (by training, he is a nuclear engineer and physicist). He tells the following story: Of the five top officers in a submarine, three have to be present and press the correct buttons to launch the missiles. That is done deliberately, so even if part of the crew is disabled, the submarine can continue to function.
However, to officially destroy outdated medications (such as aspirin and disinfectant) in the submarine's medical office, ALL FIVE senior officers hat to be present and witness the counting and destruction. That might sound bizarre, but supposedly it makes sense.
Any military will, with time, turn into a bizzare bureaucracy. Just ask any service member.That might sound bizarre, but supposedly it makes sense.
Any military will, with time, turn into a bizzare bureaucracy. Just ask any service member.