Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonatas CD joncasdam

View GitHub Profile
View deals_draft.json
[
{
"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",
View shortening_urls_with_google.py
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'})
View pandas_csv_excel_conversion
#!/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)
@joncasdam
joncasdam / floydwarshall.py
Created Sep 15, 2015
simple python implemetation of Floyd-Warshall alghorithm
View floydwarshall.py
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] = {}
@joncasdam
joncasdam / python2_7_8_alongside_python2_6_on_CentOS
Last active Aug 29, 2015
Installing Python 2.7.8 on CentOS 6.x where Python 2.6.x is the current version
View python2_7_8_alongside_python2_6_on_CentOS
# 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
You can’t perform that action at this time.