This file contains 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
#! python3 | |
# downloadXkcd.py - Downloads every single XKCD comic. | |
import requests, os, bs4 | |
url = 'http://xkcd.com' # starting url | |
os.makedirs('xkcd', exist_ok=True) # store comics in ./xkcd | |
while not url.endswith('#'): | |
# Download the page. | |
print('Downloading page %s...' % url) |
This file contains 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
#!/bin/bash | |
function partition { | |
let i=$2-1 | |
let pivot=${x[$3]} | |
for(( j="$2"; j<"$3"; j++ )) | |
do | |
if [ "${x[$j]}" -lt "$pivot" ] | |
then |
This file contains 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 <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int n; | |
cin>>n; | |
int a[n]; | |
bool b[n]; | |
fill(b, b + n, true); |
This file contains 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
https://www.analyticsvidhya.com/blog/2017/07/web-scraping-in-python-using-scrapy/ | |
https://www.analyticsvidhya.com/blog/2017/07/beginner-guide-build-data-visualisations-web-d3-js/ | |
https://www.analyticsvidhya.com/blog/2017/07/30-questions-test-data-scientist-natural-language-processing-solution-skilltest-nlp/ | |
https://www.analyticsvidhya.com/blog/2017/07/word-representations-text-classification-using-fasttext-nlp-facebook/ |
This file contains 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
# Implementation of classic arcade game Pong | |
try: | |
import simplegui | |
except ImportError: | |
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui | |
import random | |
# initialize globals - pos and vel encode vertical info for paddles |
This file contains 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 numpy as np | |
from numba import jit | |
@jit | |
def aprox_pi(N): | |
points = 2 * np.random.rand(N, 2) - 1 | |
M = 0 | |
for k in range(N): | |
if points[k,0]**2 + points[k,1]**2 < 1.: |
This file contains 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
f = open('tempSum2', 'r') | |
sum = 0 | |
for l in f: | |
if not l.strip(): | |
continue | |
sum += int(l.strip()) | |
print(sum) |
This file contains 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
f = open('sumFile2', 'r') | |
f2 = open('tempSum2', 'w') | |
import re | |
for line in f: | |
line2 = re.sub(r'\s' , '\n', line) | |
f2.write(line2) | |
f.close() | |
f2.close() |
This file contains 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
f = open('file-20171020T1500.json', 'r') | |
import json | |
import operator | |
dc = {} | |
dc_n = {} | |
for l in f: | |
j = json.loads(l) | |
scans = j["scans"] |
This file contains 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 os | |
import glob | |
import hashlib | |
a = set() | |
filenames = glob.glob("./waldo/*.jpg") | |
for filename in filenames: | |
with open(filename, 'rb') as inputfile: | |
data = inputfile.read() |
OlderNewer