This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
import requests | |
import csv | |
odesk_output = requests.get('https://www.odesk.com/api/profiles/v1/metadata/skills.json') | |
skills = odesk_output.json()['skills'] | |
csvfile = 'odesk_skills.csv' | |
with open(csvfile, "w")as output: | |
writer = csv.writer(output, lineterminator='\n') | |
for skill in skills: |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
from collections import Counter | |
cnt = Counter() | |
some_data = ['a','b','v','c','l','c'] | |
for item in some_data: | |
cnt[item] += 1 | |
print cnt |
frequency_count = dict() | |
some_data = ['a','b','v','c','l','c'] | |
for item in some_data: | |
if item in frequency_count: | |
frequency_count[item] += 1 | |
else: | |
frequency_count[item] = 1 | |
print frequency_count |
from collections import defaultdict | |
some_data = ['a','b','v','c','l','c'] | |
frequency_count = defaultdict(int) | |
for item in some_data: | |
frequency_count[item] += 1 | |
print frequency_count | |
from collections import Counter | |
some_data = ['a','b','v','c','l','c'] | |
result = Counter(some_data) |
* First allot an Elastic IP. This option is available under Network and Security | |
* Right click the IP shown and associate the IP with the ubuntu instance. | |
* Add a security rule for http with port 80. | |
* Install Nginx | |
* Test Nginx sudo /etc/init.d/nginx start | |
** Go to web browser and type your elastic ip assigned. You should see 'Welcome to Nginx" | |
* Then go to /etc/nginx/sites-available and setup your default. Add the following lines | |
server { |
from django.forms.formsets import BaseFormSet | |
class RequiredFormSet(BaseFormSet): | |
def __init__(self, *args, **kwargs): | |
super(RequiredFormSet, self).__init__(*args, **kwargs) | |
for form in self.forms: | |
form.empty_permitted = False |
from datetime import datetime, time | |
# getting date from form | |
dt = datetime.strptime(request.form['date'], '%Y-%m-%d') | |
# adding date for a record | |
record = {} | |
# need to add time (0,0) | |
record['date'] = datetime.combine(dt, time()) |
fn print_non_wining_places(won_place: i32) { | |
let mut display = String::new() ; | |
let mut string_number ; | |
for x in 0..200 { | |
if x != won_place && x != 0 { | |
string_number = x.to_string() ; | |
let mut copy_string_number = x.to_string() ; |