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 / 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:
@josemarcosrf
josemarcosrf / NaturalLanguageFrameworks.md
Created November 13, 2019 13:41
NLU libraries and frameworks
@josemarcosrf
josemarcosrf / useful_commands.md
Last active October 11, 2019 19:01
Useful bash commands

Find text inside of a file

grep -rn . -e <your-pattern>

Find and replace

find /path/to/files -type f -exec sed -i 's/oldstring/new string/g' {} \;

Use find to create symlink to all files in some dir to the current dir

find -type f -exec ln -sf {} $(pwd) \;

@josemarcosrf
josemarcosrf / create_user.sh
Created October 8, 2019 11:39
Create a new user in UBuntu 18.04 and enable remote SSH login
#!/usr/bin/env bash
say() {
echo "$@" | sed \
-e "s/\(\(@\(red\|green\|yellow\|blue\|magenta\|cyan\|white\|reset\|b\|u\)\)\+\)[[]\{2\}\(.*\)[]]\{2\}/\1\4@reset/g" \
-e "s/@red/$(tput setaf 1)/g" \
-e "s/@green/$(tput setaf 2)/g" \
-e "s/@yellow/$(tput setaf 3)/g" \
-e "s/@blue/$(tput setaf 4)/g" \
-e "s/@magenta/$(tput setaf 5)/g" \
@josemarcosrf
josemarcosrf / compare-pip.py
Last active October 2, 2019 13:24
Compare two `pip freeze` output files
import sys
from pprint import pformat
def read_pip_freeze_file(file_path):
try:
with open(file_path, 'r') as f:
return [l.strip() for l in f.readlines()]
except Exception as e:
print("Error while reading pip freeze file: {}".format(e))
@josemarcosrf
josemarcosrf / bash_functions.sh
Last active May 3, 2026 15:12
Collection of useful bash functions. `source bash_functions.sh` to have them ready in the shell.
# NOTE: To make any function here work with 'watch':
# export -f your-function-name
# watch --exec bash -c your-function-name
# ===============================================
# Generic functions
# ===============================================
function say() {
#!/usr/bin/env python3
"""
quicky script that compares two conda environments
can be handy for debugging differences between two environments
This could be made much cleaner and more flexible -- but it does the job.
Please let me know if you extend or improve it.
@josemarcosrf
josemarcosrf / private_fork.md
Last active September 14, 2020 11:31 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The correct way of creating a private frok by duplicating the repo is documented here.

We assume the following:

  • Old or original repo is: git@github.com:<user>/<old-repo>.git
  • New mirror will be: git@github.com:<your_username>/mirror.git

For this, the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)