Skip to content

Instantly share code, notes, and snippets.

View ronaldokun's full-sized avatar
🏠
Working from home

ronaldokun

🏠
Working from home
View GitHub Profile
@ronaldokun
ronaldokun / execute_nb.py
Created January 26, 2024 01:49
Execute notebook in a terminal
#!/usr/bin/env python
import nbformat,fire
from nbconvert.preprocessors import ExecutePreprocessor
def run_notebook(path):
nb = nbformat.read(open(path), as_version=nbformat.NO_CONVERT)
ExecutePreprocessor(timeout=600).preprocess(nb, {})
print('done')
@ronaldokun
ronaldokun / History\-10e19d43\entries.json
Last active February 14, 2023 15:16
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///c%3A/Users/rsilva/code/anateldb/extracao/reading.py","entries":[{"id":"aEyo.py","timestamp":1675198943147},{"id":"gZqW.py","timestamp":1675342978085},{"id":"fsOp.py","timestamp":1675342988883}]}
@ronaldokun
ronaldokun / cloudSettings
Created June 18, 2021 02:34
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-06-18T02:34:22.337Z","extensionVersion":"v3.4.3"}
@ronaldokun
ronaldokun / selenium.py
Created May 26, 2021 17:55 — forked from korakot/selenium.py
Use selenium in Colab
# install chromium, its driver, and selenium
!apt update
!apt install chromium-chromedriver
!pip install selenium
# set options to be headless, ..
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
@ronaldokun
ronaldokun / jupyter_ngrok.md
Created July 22, 2020 16:41 — forked from artificialsoph/jupyter_ngrok.md
Quickest way to get Jupyter notebook running on a remote server.

Log into your server with ssh, something like

ssh -i "my_secret.pem" ubuntu@12.123.12.123

If it's a new server, you'll need to install a few things.

Install conda with

@ronaldokun
ronaldokun / pandas_crossjoin_example.py
Created January 25, 2020 21:37 — forked from internaut/pandas_crossjoin_example.py
Shows how to do a cross join (i.e. cartesian product) between two pandas DataFrames using an example on calculating the distances between origin and destination cities. See https://mkonrad.net/2016/04/16/cross-join--cartesian-product-between-pandas-dataframes.html
"""
Shows how to do a cross join (i.e. cartesian product) between two pandas DataFrames using an example on
calculating the distances between origin and destination cities.
Tested with pandas 0.17.1 and 0.18 on Python 3.4 and Python 3.5
Best run this with Spyder (see https://github.com/spyder-ide/spyder)
Author: Markus Konrad <post@mkonrad.net>
April 2016
@ronaldokun
ronaldokun / Change HOMEDRIVE HOMEPATH and HOMESHARE
Created May 23, 2018 22:19
Change HOMEDRIVE HOMEPATH and HOMESHARE in a Windows with Group Policy
c:\> set HOME
HOME=C:\Users\rsilva
HOMEDRIVE=U:
HOMEPATH=\
HOMESHARE=\\WIFSSP01\EstruturaFS\usu\rsilva
The Drive U: is a network drive defined by the Group Policy in the organization. It's very slow.
1. I had a similar problem, which caused problems with msysgit. Here is the solution I used, and it definately worked for me. This answer is similar to this and that SO post.If you are on Windows 7, you can skip this step. If you are on Windows XP, download and install Windows XP Service Pack 2 Support Tools which contains SETX, a utility, described on SS64 and technet, that lets you set permanent system and user variables. You must have administrative rights to set global system variables. The basic usage is SETX <variable> "<value>" [-m].
2. Add the following script to your startup folder - W7: "C:\Users\<username>\Start Menu\Programs\Startup" and XP: "C:\Documents and Settings\<username>\Start Menu\Programs\Startup".
@ronaldokun
ronaldokun / Enabling GPU support of xgboost
Last active May 23, 2018 22:00
Include GPU support in xgboost
To support GPU. The xgboost library must be build from the github code.
The instructions on https://xgboost.readthedocs.io/en/latest/build.html are straightforward.
Except for a little detail:
we must use:
sudo -s
python setup.pu install
@ronaldokun
ronaldokun / subplots.py
Created April 3, 2018 21:28 — forked from dyerrington/subplots.py
Plotting multiple figures with seaborn and matplotlib using subplots.
##
# Create a figure space matrix consisting of 3 columns and 2 rows
#
# Here is a useful template to use for working with subplots.
#
##################################################################
fig, ax = plt.subplots(figsize=(10,5), ncols=3, nrows=2)
left = 0.125 # the left side of the subplots of the figure
right = 0.9 # the right side of the subplots of the figure
#sudo dpkg --install cuda-repo-<distro>-<version>.<architecture>.deb
#sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/<distro>/<architecture>/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda
$ sudo apt-get install nvidia-cuda-toolkit
Reboot the system to load the NVIDIA drivers.
Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables: