Implement a REST server with the following endpoints.
Body
{
"username": "XXXXXXX”
}
| def r(m, g, l, d, u, j): | |
| # print "r iteration: "+str(d) | |
| if d == len(l)+10: | |
| return False | |
| mS = sum(m) | |
| mL = len(m) | |
| if mS == g: | |
| return m | |
| if mS < g*(1.0+j) and mS > g*(1.0-j): | |
| return m |
| $(".status").each(function(index, element) { if($(element).html().indexOf("Deleted") != -1 ) { $(element).parent().hide(); }; }); |
| # First initialize the array with all positions 0 | |
| array_2d = None | |
| calculated_values = None | |
| # save the total number of rows and the total number of columns in global variables | |
| rows_n = 0 | |
| columns_n = 0 | |
| testing = False | |
| # Now make the function to obtain the values at y_row, and x_column |
| HIGHEST_PROCESS='' | |
| HIGHEST_PROCESS_FILES=0 | |
| ps aux | awk 'NR > 1' | awk '{ print $2 }' > tmp.txt | |
| while read -r process_element; do | |
| process_pid="$process_element" | |
| number_of_files=`lsof -p $process_pid | wc -l | awk '{ print $1 }'` | |
| if [ $number_of_files -gt $HIGHEST_PROCESS_FILES ]; then | |
| HIGHEST_PROCESS=$process_pid | |
| HIGHEST_PROCESS_FILES=$number_of_files | |
| fi |
| function sendTextMessage(sender, text) { | |
| let messageData = { text:text } | |
| request({ | |
| url: 'https://graph.facebook.com/v2.6/me/messages', | |
| qs: {access_token:token}, | |
| method: 'POST', | |
| json: { | |
| recipient: {id:sender}, | |
| message: messageData, |
| var chromeCapabilities, chromeOptions, driver; | |
| chromeCapabilities = selenium.Capabilities.chrome(); | |
| chromeOptions = { | |
| 'args': ['--load-extension=yourExtensionFolder'] | |
| }; | |
| chromeCapabilities.set('chromeOptions', chromeOptions); | |
| driver = new selenium.Builder().usingServer('http://x.x.x.x:4444/wd/hub').withCapabilities(chromeCapabilities).build(); | |
| driver.getWindowHandle(); |
| java -jar selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register -browser browserName=chrome,version=52.0,chrome_binary='/usr/bin/google-chrome',platform=LINUX,maxInstances=5 |
| def binarySearch(alist, item): | |
| first = 0 | |
| last = len(alist)-1 | |
| index = None | |
| while first<=last and not index: | |
| midpoint = (first + last)//2 | |
| if alist[midpoint] >= item: | |
| index = midpoint | |
| else: | |
| if item < alist[midpoint]: |
| def binarySearch(alist, item): | |
| first = 0 | |
| last = len(alist)-1 | |
| index = None | |
| while first<=last and not index: | |
| midpoint = (first + last)//2 | |
| if alist[midpoint] >= item: | |
| index = midpoint | |
| else: | |
| if item < alist[midpoint]: |