Skip to content

Instantly share code, notes, and snippets.

View vrootic's full-sized avatar

Vic vrootic

View GitHub Profile
import datetime
import time
from BeautifulSoup import BeautifulSoup
import requests
def get_content(url):
res = requests.get(url)
return res.content
#!/usr/bin/env python
'''
sample input
['1-800-power.com', 'ca.shtml\n']
'''
record = []
for line in open("order.txt", "r").readlines():
for element in line.split("'"):
record.append(element)
import requests
request_api = 'https://api.foursquare.com/v2/venues/search'
your_client_id = ''
your_client_secret = ''
your_v = '20140902'
your_near = 'New York, NY'
import matplotlib.pyplot as plt
x = all_set.keys()
#y = mean_map
y = std_map
fig, ax = plt.subplots()
heatmap = ax.pcolor(np.array(y), cmap=plt.cm.Greens)
cbar = fig.colorbar(heatmap)
#cbar.ax.set_yticklabels(['< -1', '0', '> 1'])
@vrootic
vrootic / cdf.py
Created September 19, 2014 05:10
import numpy as np
import matplotlib.pyplot as plt
data = []
with open("output.txt", "r") as f:
for line in f.readlines():
data.append(float(line))
x = []
@vrootic
vrootic / gist:197a0716d92bbc74f420
Created September 30, 2014 10:31
RtlSdr Installation guide
1. brew install libusb
2. brew install librtlsdr
3. brew install python
4. pip install pyrtlsdr
5. pip install numpy
6. pip install pandas
7. git clone https://github.com/roger-/pyrtlsdr.git
8. cd pyrtlsdr && python demo_waterfall.py
#!/usr/bin/env python
import numpy as np
import pandas as pd
import data_generator as dg
def reduce_data():
result = []
for day in dg.group_data():
#include <stdio.h>
#define SQUARE(a) (a * a)
int main() {
printf("%d\n", SQUARE(4));
int x = 3;
printf("%d\n", SQUARE(++x));
return 0;
}
In [54]: a = [i for i in range(10)]
In [58]: zip(*[iter(a), iter(a), iter(a), iter(a), iter(a)])
Out[58]:
[(0, 0, 0, 0, 0),
(1, 1, 1, 1, 1),
(2, 2, 2, 2, 2),
(3, 3, 3, 3, 3),
(4, 4, 4, 4, 4),
(5, 5, 5, 5, 5),
(6, 6, 6, 6, 6),
In [37]: a = iter(range(45))
In [38]: zip(*[a, a, a])
Out[38]:
[(0, 1, 2),
(3, 4, 5),
(6, 7, 8),
(9, 10, 11),
(12, 13, 14),
(15, 16, 17),