Skip to content

Instantly share code, notes, and snippets.

View mfurquimdev's full-sized avatar
🐧

Mateus Furquim mfurquimdev

🐧
View GitHub Profile
@mfurquimdev
mfurquimdev / min-char-rnn.py
Created November 19, 2021 01:08 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@mfurquimdev
mfurquimdev / hotload_unittest.sh
Created October 29, 2021 17:27
Run all `test_hot_` tests with pytest everytime any file is modified
#!/bin/bash
inotifywait -q -m -e close_write -r */ --exclude ".*.pyc|.coverage" | while read -r path event filename;
do
echo -e "\n\n\033[1;7;37mRunning test because $path$filename was $event\033[0;1;0m"
pipenv run pytest -s -vv -x tests -k 'test_hot_'
done;
@mfurquimdev
mfurquimdev / argprint.py
Created September 10, 2021 13:07 — forked from DarwinAwardWinner/argprint.py
Print a Python function's arguments every time it is called
# This file defines a decorator '@log_to()' that logs every call to a
# function, along with the arguments that function was called with. It
# takes a logging function, which is any function that accepts a
# string and does something with it. A good choice is the debug
# function from the logging module. A second decorator '@logdebug' is
# provided that uses 'logging.debug' as the logger.
from __future__ import print_function
from functools import wraps
from inspect import getcallargs, getargspec
@mfurquimdev
mfurquimdev / crawl_directories.sh
Created September 1, 2021 12:39
Crawl project directories and update master branches
for d in *;
do
if [ -d "$d" ];
then
pushd "$d";
update_master.sh
popd;
fi;
done;
@mfurquimdev
mfurquimdev / rr_line.sh
Last active August 6, 2021 13:53
Print random range of lines from a file
#!/bin/bash
if [[ -z "$1" ]]; then
# Read shell parameter expansion to understand better what this answer do
# https://stackoverflow.com/a/965072/3832827
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
echo "usage: $(basename $0) <file_name> [show_n_lines]";
exit 1;
fi
@mfurquimdev
mfurquimdev / hot_load.sh
Created June 30, 2021 10:38
Execute command on changing file (kills it if it had previously ran)
inotifywait -q -m -e close_write tasks/behaviour_training.py | while read -r filename event; do echo "train@$train_pid"; if [ -n "$train_pid" ]; then echo "Killing"; kill $train_pid; fi; echo "Running"; pipenv run train& train_pid="$!"; done;
@mfurquimdev
mfurquimdev / get_tasks.sh
Created June 29, 2021 19:13
Get all Celery tasks on redis
#!/bin/bash
for task in $(printf "select 7\r\nkeys *\r\nquit\r\n" | nc localhost 6379 | grep celery); do printf "select 7\r\nget $task\r\nquit\r\n" | nc localhost 6379; done
#!/bin/python
mensalidade=400 # R$400
dias=21 # 21 dias úteis no mês
transporte=3.5*2*dias # R$3,50 por ônibus, ida e volta (x2)
monthly_spent=mensalidade+transporte # Dinheiro gasto no mês com este propósito
daily_yield=0.02 # Objetivo diário de ganho 3%
initial_ammount=1000 # Começando com R$1000
monthly_earnings=0
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! title Nord XResources +
! project nord-xresources +
! version 0.1.0 +
! repository https://github.com/arcticicestudio/nord-xresources +
! author Arctic Ice Studio +
! email development@arcticicestudio.com +
! copyright Copyright (C) 2016 +
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define nord0 #2E3440
set nocompatible " be iMproved, required
filetype off " required
" Remove all autocmds
autocmd!
let $VIM='~/.vim/'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugin stuff