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
# Python 2.7.8 alongside 2.6 in CentOS | |
# based on Juliano Resende's tutorial at http://www.gorobei.net/instalando-o-python-2-7-8-no-centos-6-x/ | |
# Make sure that your user is on sudoers and wheel group | |
$ usermod -G wheel usuario | |
# Some installing before going to python it self | |
$ yum update | |
$ yum install gcc44 gcc44-c++ gcc44-gfortran | |
$ yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget |
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
def floydwarshall(graph): | |
# simple python implemetation of Floyd-Warshall alghorithm | |
# https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm#Path_reconstruction | |
# source: https://jlmedina123.wordpress.com/2014/05/17/floyd-warshall-algorithm-in-python/ | |
# author: J. Luis Medina | |
dist = {} | |
pred = {} | |
for u in graph: | |
dist[u] = {} | |
pred[u] = {} |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
import pandas as pd | |
if conversion_type == 'csv_to_excel': | |
input_file = pd.read_csv(input_file) | |
input_file.to_excel(output_file) | |
elif conversion_type == 'excel_to_csv'; | |
input_file = pd.read_excel(input_file) |
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 requests | |
import json | |
api_url = 'https://www.googleapis.com/urlshortener/v1/url' | |
api_key = '' # find here how to get yours https://developers.google.com/url-shortener/v1/getting_started#APIKey | |
url = '{0}?key={1}'.format(api_url, api_key) | |
headers = {'content-type': 'application/json'} | |
params = json.dumps({'longUrl': 'http://www.google.com'}) |
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
[ | |
{ | |
"slug":"zalando", | |
"title":"Zalando", | |
"subtitle":"Shop online", | |
"visibility":"publishable", | |
"order": 2, | |
"has_highlighted_deal": true, | |
"is_published":true, | |
"logo_image":"https://www.dropbox.com/s/9005bsjr493xid5/100-crop-c0-5__0-5-200x200-70.jpg?dl=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
Alamofire.request(urlString).responseJSON { response in | |
guard case let .failure(error) = response.result else { return } | |
if let error = error as? AFError { | |
switch error { | |
case .invalidURL(let url): | |
print("Invalid URL: \(url) - \(error.localizedDescription)") | |
case .parameterEncodingFailed(let reason): | |
print("Parameter encoding failed: \(error.localizedDescription)") | |
print("Failure Reason: \(reason)") |