This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def start_instance_elections(instance_ids): | |
| session = boto3.session.Session(profile_name='default') | |
| ec2_resource = session.resource('ec2')#high level resource level | |
| key = paramiko.RSAKey.from_private_key_file('/home/edward/workspace/waka/mykeypair.pem') | |
| Port = 22 | |
| ssh = paramiko.SSHClient() | |
| ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
| print('starting election on instances') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) { | |
| MyScanner in = new MyScanner(); | |
| } | |
| // -----------MyScanner class for faster input---------- | |
| public static class MyScanner { | |
| BufferedReader br; | |
| StringTokenizer st; | |
| public MyScanner() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| int port = 8000; | |
| InetAddress address = InetAddress.getByName("8.8.8.8"); | |
| DatagramSocket socket = new DatagramSocket(); | |
| socket.setSoTimeout(2000); | |
| socket.connect(address, port); | |
| for(int i = 0; i < NUM_TRIALS; i++){ | |
| String str = "PING " + i + " \n"; | |
| byte[] buf = new byte[1024]; | |
| buf = str.getBytes(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| long startTime = System.currentTimeMillis(); | |
| int port = 8000; | |
| InetAddress server = InetAddress.getByAddress("8.8.8.8".getBytes()); | |
| DatagramSocket socket = new DatagramSocket(port); | |
| byte[] buf = new byte[1024]; | |
| DatagramPacket ping = new DatagramPacket(buf, buf.length, server, port); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| latencyAvg = getLatencyAvg(); | |
| loadAvg = getLoadAvg(); | |
| uptimeAvg = getUptimeAvg(); | |
| IOWaitAvg = getIOWaitAvg(); | |
| latencyAvg = ((latencyAvg) / (500)); | |
| loadAvg = ((loadAvg) / (10)); | |
| uptimeAvg = uptimeAvg/1000; | |
| uptimeAvg = ((uptimeAvg) / (3600)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* globals React */ | |
| const shallow = require('enzyme').shallow; | |
| const expect = require('chai').expect; | |
| const setup = require('static/bundles/test/componentSetup'); | |
| const courseViewGradeData = require('static/bundles/ondemand/components/__fixtures__/CourseViewGrade.mock'); | |
| const courseMaterialData = require('static/bundles/author-grade/stores/__tests__/fixtures/courseMaterialData.newGradeWeights.js'); | |
| const beforeEachLoadPromisedObject = require('static/bundles/phoenix/test/lib/beforeEachLoadPromisedObject'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #unpythonic code in idiom_tests_copy.py: | |
| result = [] | |
| for i in range(10): | |
| s = i ** 2 | |
| result.append(s) | |
| print(sum(result)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from redbaron import RedBaron | |
| import json | |
| with open("the_unidiomatic_python_file.py", "r") as source_code: | |
| red = RedBaron(source_code.read()) | |
| red | |
| del red[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -bash-4.2$ ./pf -x 1024 -y 1024 -z 100 -np 10000 | |
| VIDEO SEQUENCE TOOK 12.033136 | |
| XE: 512.549820 | |
| YE: 512.463238 | |
| 0.718951 | |
| XE: 510.455943 | |
| YE: 513.535434 | |
| 2.177538 | |
| XE: 508.490030 | |
| YE: 514.503280 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -bash-4.2$ ./pf -x 32 -y 32 -z 100 -np 10000 | |
| VIDEO SEQUENCE TOOK 0.028908 | |
| XE: 16.549820 | |
| YE: 16.463238 | |
| 0.718951 | |
| XE: 14.455943 | |
| YE: 17.535434 | |
| 2.177538 | |
| XE: 12.490030 | |
| YE: 18.503280 |