Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Paulo Haddad paulochf

🎯
Focusing
Block or report user

Report or block paulochf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@paulochf
paulochf / pandas_set_operation.ipynb
Last active Jul 25, 2018
Set intersection between pandas columns
View pandas_set_operation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulochf
paulochf / get_slack_threads.ipynb
Last active Jul 30, 2018
Get starred threads dialogs from Slack
View get_slack_threads.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulochf
paulochf / moar_pandas.py
Last active Apr 26, 2018
More rows/columns/width in pandas table printings without truncation
View moar_pandas.py
import pandas as pd
pd.set_option("display.max_rows", 200)
pd.set_option("display.max_columns", 100)
pd.set_option("display.max_colwidth", 200)
## Reset to defaults
# pd.reset_option("^display")
@paulochf
paulochf / jupyter.service
Created Apr 18, 2018
Jupyter Notebook as service in Ubuntu
View jupyter.service
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
# https://gist.github.com/whophil/5a2eab328d2f8c16bb31c9ceaf23164f
# PUT THIS IN /usr/lib/systemd/system
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
@paulochf
paulochf / s3fs_profile.py
Created Mar 24, 2018
Use python s3fs to connect to AWS using specific profile (already in ~/.aws/)
View s3fs_profile.py
from s3fs.core import S3FileSystem
s3 = S3FileSystem(anon=False, profile_name="your-profile-name")
print(s3.ls("s3://your-bucket/some-folder"))
@paulochf
paulochf / fix.sh
Created Feb 15, 2018
Pritunl icon in Ubuntu top task bar workaround
View fix.sh
#!/usr/bin/env bash
# Doesn't fix the icon to have the right appearance, but stop the top bar from being ridiculously big.
cd /usr/share/pritunl_client && for f in `ls *svg`; do sudo sed -i -E -e 's/200([ "])/24\1/g' $f; done && cd -
@paulochf
paulochf / mapping_street_carnival.ipynb
Last active Feb 12, 2018
Mapping street carnival parties
View mapping_street_carnival.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulochf
paulochf / load.ipynb
Created Feb 1, 2018
Load data matrix using Numpy
View load.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulochf
paulochf / some_transformers.py
Created Jan 16, 2018
A label enconding transformer
View some_transformers.py
from sklearn.base import BaseEstimator, TransformerMixin
class NoFitMixin:
"""Gives fit method by inheritance."""
def fit(self, X, y=None, **fit_params):
return self
class LabelFeaturizer(BaseEstimator, TransformerMixin, NoFitMixin):
@paulochf
paulochf / types_max_values_ordering.ipynb
Created Nov 28, 2017
Numpy types ordering regarding their maximum values
View types_max_values_ordering.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.