Skip to content

Instantly share code, notes, and snippets.

@mnkhouri
Created September 20, 2016 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnkhouri/c1b16c1d141384c19821757855999cd8 to your computer and use it in GitHub Desktop.
Save mnkhouri/c1b16c1d141384c19821757855999cd8 to your computer and use it in GitHub Desktop.
Embedded interview questions
Update System
In any scripting language, write a script to update an embedded system.
Your embedded system's specifications are completely up to you. Please
write down any important details about it.
The script should accept two parameters:
- url to get the blob from
- md5 of the blob
The update mechanism itself is up to you -- pick out anything you've seen
used before. If you don't have one in mind, feel free to assume that we
are writing the downloaded image directly to NAND using nandwrite().
The script (and system as a whole) should have some error handling and
should try to be robust in handling network failures or user error (i.e.
pulling the power plug).
Website Checker
Write a C program which accepts two command line parameters: "url" and "command".
When invoked, the program should perform an HTTP Get on the given "url". If the
status code in the response is `200`, the program should call the given "command".
The program should have the following return values:
0: got `200` on Get to "url", "command" was successfully called
5: did not get `200` from "url"
6: error when calling "command"
You use any online resource for reference, and any external libraries, if
needed.
The program must:
- compile and run on this machine
- accept the parameters and return the values listed above
- be committed to a new Git repository
- use `make`, and have a Makefile (doesn't need to be complex)
The program should, in a minimal way:
- perform some kind of logging
- have some kind of testing
Example:
> make
> ./yourProgramName "example.com" "echo 'Hello, world!'"
Hello, world!
> echo $?
0
> ./yourProgramName "BadAddress.badTLD" "echo 'Hello, world!'"
Warning: could not reach "BadAddress.badTLD"
> echo $?
5
> git status
On branch master
nothing to commit, working directory clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment