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 / 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 July 2, 2025 19:00
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
function 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" \
#!/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:

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.)
@josemarcosrf
josemarcosrf / conda_DL_environment.json
Created June 20, 2019 11:55
Conda DL environment
name: DL
channels:
- pytorch
- caffe2
- conda-forge
- soumith
- defaults
dependencies:
- _nb_ext_conf=0.4.0=py36_1
- anaconda-client=1.6.3=py36_0
@josemarcosrf
josemarcosrf / conda_testDL_environment.yaml
Last active July 30, 2019 14:55
Conda test DL environment
name: testDL
channels:
- pytorch
- soumith
- defaults
dependencies:
- blas=1.0=mkl
- ca-certificates=2018.12.5=0
- certifi=2018.11.29=py36_0
- cffi=1.11.5=py36he75722e_1
@josemarcosrf
josemarcosrf / convert_html_to_ipynb.py
Created May 29, 2019 17:46
Python script to convert an HTML jupyter notebook export to an actual ipynb file (ipython notebook)
# Script originally posted by stackOverflow user 'sgDysregulation':
# https://stackoverflow.com/questions/28972614/ipython-notebook-convert-an-html-notebook-to-ipynb
# Requirements:
# beautifulsoup4==4.7.1
# lxml==4.3.3
# urllib3==1.24.1
# simplejson==3.13.2
# To check if lxml is available as a parser: