Skip to content

Instantly share code, notes, and snippets.

View josemarcosrf's full-sized avatar
🏔️
Working from a mountain top

Jose Marcos RF josemarcosrf

🏔️
Working from a mountain top
View GitHub Profile
@josemarcosrf
josemarcosrf / easy_install_cuda_ubuntu-1804.sh
Last active November 10, 2021 08:24
Install NVIDIA drivers and CUDA for Ubuntu 18.04 LTS
CUDA_REPO_PKG=cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64
wget -O /tmp/${CUDA_REPO_PKG} ${CUDA_URL}/${CUDA_REPO_PKG}
sudo dpkg -i /tmp/${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys ${CUDA_URL}/7fa2af80.pub
rm -f /tmp/${CUDA_REPO_PKG}
@josemarcosrf
josemarcosrf / py_wrappers.py
Created April 29, 2020 17:06
A collection of useful python wrapper functions
import time
from functools import wraps
from typing import List
from typing import Union
import numpy as np
import psutil
from sklearn import preprocessing
@josemarcosrf
josemarcosrf / local_vscode_settings.jsonc
Last active March 4, 2021 15:42
VSCode custom color settings collection to differentiate between multiple opened instances
{
// https://www.schemecolor.com/dysfunctional.php
"workbench.colorCustomizations": {
// activity bar
"activityBar.background": "#CE3C63",
"activityBar.inactiveForeground": "#c5c4c4",
"activityBar.activeBackground": "#FBE9B7",
"activityBar.activeBorder": "#04B9B0",
// badge
"activityBarBadge.background": "#04B9B0",
@josemarcosrf
josemarcosrf / ToggleColorSchemeCommand.py
Last active March 22, 2020 16:55 — forked from rbf/Default (OSX).sublime-keymap
A simple way to toggle between dark and light themes in Sublime Text 2, also for open files in the .workspace settings file.
# From https://gist.github.com/rbf/195acdfe8f51b65e5ecd
# Forked from https://gist.github.com/jasonlong/5395357
# // Copy this to your keybindings (Preferences > Key Bindings - User)
# // Change the keybinding, color schemes, and themes to your preferences
#
# {
# "keys": ["ctrl+shift+s"], "command": "toggle_color_scheme",
# "args": {
# "light_color_scheme": "Packages/User/Soda Light - Espresso.tmTheme",
@josemarcosrf
josemarcosrf / func_default_params.py
Created February 25, 2020 15:26
Careful with python default list parameters!
class A:
"""This is an example of wrong functions default parameters:
This should actually be:
def __init__(self, l=None):
if l is None:
self.l = []
"""
def __init__(self, l=[]):
self.l = l
@josemarcosrf
josemarcosrf / multiline-values.yaml
Created February 25, 2020 15:01 — forked from rjattrill/multiline-values.yaml
Break YAML over multiple lines
# Join multiple lines without new line
value: >
part 1
part 2
# Join with newline
value2: |
line 1
line 2
@josemarcosrf
josemarcosrf / logio.py
Last active November 18, 2022 18:52
Python logging coloredlogs styling utility functions
import sys
import os
from loguru import logger
from tqdm.auto import tqdm
from functools import partialmethod
class TqdmStream(object):
@classmethod
@josemarcosrf
josemarcosrf / vscode-debug-launch.json
Created January 14, 2020 20:13
VSCode debug configuration examples
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
@josemarcosrf
josemarcosrf / postman_install.sh
Created November 28, 2019 10:50 — forked from cagcak/postman_install.sh
Postman install Ubuntu 18.04
#!/bin/bash
# Get postman app
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
#Create a Desktop Entry
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
@josemarcosrf
josemarcosrf / language_to_iso_code.py
Last active November 14, 2019 15:10 — forked from flaviussn/language_to_iso_code.py
From language name to ISO code
import pycountry
from pprint import pformat
from data.model_languages import bert_languages, xlm_lang_codes
def get_codes(language):
lang = pycountry.languages.get(name=language)
alpha_2 = alpha_3 = None
try: