Skip to content

Instantly share code, notes, and snippets.

@paiva
paiva / df.py
Last active March 8, 2017 04:37
This is a description test
import pandas as pd
raw_df = pd.read_csv('pages.csv')
def get_global_data(self):
"""Extracts global metrics from Google Webmaster Tools
Args:
Month: Month to evaluate
@paiva
paiva / gwt.py
Created March 8, 2017 04:06
Google Webmaster Tools Library
# This code has been adapted from the source provided by Vijay Singh
# URL: http://amintor.com/1/post/2013/11/technology-extend-python-library-for-google-web-master-tools.html
import os,json, re
import datetime, calendar
from datetime import date, timedelta
from dateutil.relativedelta import relativedelta
from dateutil import rrule
from config import GOOGLE_LOGIN,GOOGLE_PASSWORD
from config import TEMP_PATH
@paiva
paiva / ga.py
Created March 8, 2017 04:57
ga.py
import os,sys,logging
import yaml, time
import pandas as pd
from datetime import datetime
from oauth2client import client
from datetime import timedelta
from googleads import adwords
from googleads.adwords import AdWordsClient
@paiva
paiva / ga_models.py
Created March 8, 2017 14:52
ga_models.py
class GoogleAdsAccountPerformance(Base):
__tablename__ = 'googleads_account_performance'
ad_network_type_1 = Column(String(255), primary_key=True, doc='key')
ad_network_type_2 = Column(String(255), primary_key=True, doc='key')
date = Column(DateTime, primary_key=True, doc='key')
device = Column(String(255), primary_key=True, doc='key')
customer_descriptive_name = Column(String(255), doc='dimension')
account_currency_code = Column(String(50), doc='dimension')
account_descriptive_name = Column(String(255), doc='dimension')
@paiva
paiva / blockstack.txt
Created November 2, 2017 19:38
Blockstack
Verifying my Blockstack ID is secured with the address 1NEHZ3XskXaWQcayTSq6dQrAGQdKipSLNB https://explorer.blockstack.org/address/1NEHZ3XskXaWQcayTSq6dQrAGQdKipSLNB
@paiva
paiva / onename.txt
Created November 5, 2017 16:39
onename
Verifying that "santiagopaiva.id" is my Blockstack ID. https://onename.com/santiagopaiva
@paiva
paiva / verification.txt
Created November 22, 2017 04:19
Blockstack
Verifying my Blockstack ID is secured with the address 1NEHZ3XskXaWQcayTSq6dQrAGQdKipSLNB https://explorer.blockstack.org/address/1NEHZ3XskXaWQcayTSq6dQrAGQdKipSLNB
@paiva
paiva / delete_git_submodule.md
Created April 26, 2019 12:13 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@paiva
paiva / fontawesome.sty
Created June 30, 2019 00:37 — forked from sway/fontawesome.sty
FontAwesome mapping for XeLaTeX
% FontAwesome (http://fortawesome.github.com/Font-Awesome/) bindings for (Xe)LaTeX
% Author: Honza Ustohal <honza@egoistic.biz>
%
% Translation of FontAwesome's private range characters into XeTeX symbols. All icons are camel-cased and prefixed with 'fa', i.e. what was .icon-align-center the CSS version of FontAwesome becomes \faAlignCenter
% This might be reworked into a full blown package in the near future
%
% Prerequisite:
% XeLaTeX, FontAwesome installed as a system font accessible by XeLaTeX
%
% Usage:
@paiva
paiva / convert_to_python.py
Created June 8, 2020 03:14
Convert Commands to Python extension
import argparse
parser = argparse.ArgumentParser(description='Converts to Python file.')
parser.add_argument('filename', help='an integer for the accumulator')
args = parser.parse_args()
if args.filename:
try:
with open(args.filename,'r') as f: