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
| import requests | |
| from bs4 import BeautifulSoup | |
| def google_search(uri): | |
| raw_result = requests.get(uri) | |
| soup = BeautifulSoup(raw_result.content) | |
| for a in soup.find_all('a', href=True): | |
| if a['href'].startswith('/url?q=') and 'webcache.googleusercontent' not in a['href']: | |
| print(a['href'][7:].split('&sa')[0]) |
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
| Ctrl + B % - get your pane split into two 'vertically' | |
| Ctrl + B " - get your pane split into two 'horizontally' |
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
| var intervalId; | |
| var clearFunction = function() { | |
| if ($('[aria-label="Delete account"]').size() == 0) { | |
| console.log("interval cleared") | |
| clearInterval(intervalId) | |
| return | |
| } | |
| $('[aria-label="Delete account"]')[0].click(); | |
| setTimeout(function () { |
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
| url_start = 'http://ot2019.s3.amazonaws.com/192501/Ques/IEO-CS-R1-Q' | |
| url_end = '.gif' | |
| import requests | |
| for i in range(1, 41): | |
| foo = requests.get(url_start + str(i) + url_end) | |
| f = open(str(i) + '.gif', 'wb+') | |
| f.write(foo.content) | |
| f.close() |
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 twython import Twython | |
| # fill your creds from https://developer.twitter.com | |
| apiKey = '' | |
| apiSecretKey = '' | |
| accessToken = '' | |
| accessSecretToken = '' | |
| twitter = Twython(apiKey, apiSecretKey, | |
| accessToken, accessSecretToken) |
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 twython import Twython | |
| # fill your creds from https://developer.twitter.com | |
| apiKey = '' | |
| apiSecretKey = '' | |
| accessToken = '' | |
| accessSecretToken = '' | |
| twitter = Twython(apiKey, apiSecretKey, | |
| accessToken, accessSecretToken) |
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
| // depth-first search | |
| #include <iostream> | |
| #include <bits/stdc++.h> | |
| #include <vector> | |
| #include <iterator> | |
| using namespace std; | |
| class Graph { | |
| int n; | |
| vector <int> *connections; |
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
| // breadth-first search | |
| #include <iostream> | |
| #include <bits/stdc++.h> | |
| #include <vector> | |
| #include <iterator> | |
| #include <queue> | |
| using namespace std; | |
| class Graph { | |
| int n; |
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
| import _thread | |
| from threading import Thread | |
| class MergeSorter: | |
| def merge(self, left, right, myArray): | |
| i = 0 | |
| j = 0 | |
| k = 0 | |
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
| #include <iostream> | |
| using namespace std; | |
| void reverseArray(int *array, int start, int end) { | |
| for (int i = start, j = end - 1; i < j; i++, j--) { | |
| array[i] = array[i] ^ array[j]; | |
| array[j] = array[i] ^ array[j]; | |
| array[i] = array[i] ^ array[j]; | |
| } | |
| } |