Skip to content

Instantly share code, notes, and snippets.

View itolosa's full-sized avatar
🎯
Focusing

Ignacio Tolosa itolosa

🎯
Focusing
View GitHub Profile
@itolosa
itolosa / inference.py
Last active October 5, 2023 03:49
CS50AI - Lecture 2 - Bayesian Network updated source code
import torch
from model import model
X = torch.tensor(
[
[
-1,
-1,
1, # delayed
-1,
# based on edx harvard cs50ai uncertainty lesson source code
from pgmpy.models import BayesianNetwork
from pgmpy.factors.discrete import (
TabularCPD,
)
from pgmpy.inference import VariableElimination
model = BayesianNetwork(
[
@itolosa
itolosa / morse.py
Created September 28, 2023 20:02
morse translator
import random
alphabet = {
".-": "A",
"-...": "B",
"-.-.": "C",
"-..": "D",
".": "E",
"..-.": "F",

How to refactor code

Refactoring: Change the code's structure without changing its external behavior

  • Low coupling: Separate all that's possible to separate without making a mess
  • High cohesion: Minimize the mess ~ Minimize the inter-group dependencies and maximize the intra-group ones

Invariants:

  • Behavior must be the same at all times - i.e Testing
@itolosa
itolosa / clean_architecture_2023_05_16.md
Last active May 21, 2023 01:56
Clean Architecture Notes

How to pass the ViewModel from the Presenter to the View?

Solution 1: Inject a shared reference

You could use a shared reference between the view and the presenter to store the viewModel (as a data structure).

For example, using dependency injection:

Response perform(Request request) {
@itolosa
itolosa / zshrc
Created September 2, 2022 22:45
ultimo zshrc
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(evalcache rbenv brew zsh-nvm virtualenv autojump pip python urltools zsh-autosuggestions)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(context status anaconda virtualenv)
CASE_SENSITIVE="false"
DISABLE_AUTO_TITLE="true"
COMPLETION_WAITING_DOTS="true"
zmodload zsh/zprof
source $ZSH/oh-my-zsh.sh
@itolosa
itolosa / .zshrc
Created September 30, 2021 05:46
my wsl .zshrc
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(evalcache zsh-nvm virtualenv autojump pip python urltools)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(context status anaconda virtualenv)
CASE_SENSITIVE="false"
DISABLE_AUTO_TITLE="true"
COMPLETION_WAITING_DOTS="true"
zmodload zsh/zprof
source $ZSH/oh-my-zsh.sh
@itolosa
itolosa / json-schema-for-google-api-standard.json
Last active March 18, 2021 20:54
Json Schema generated from Google JSON Style Guide orderly syntax
{
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"context": {
"type": "string"
},
"id": {
function filterChars(dv: string): string {
let result = '';
for (const c of dv) {
if ((c >= '0' && c <= '9') || c === 'k') {
result += c;
}
}
return result;
}

Problema Colores Windows 10

Colores se vuelven demasiado brillantes con mucho contraste y como si estuvieran lavados al momento de cambiar desde una escena oscura a una escena mas brillante. Se demora en responder la pantalla para volver a los colores normales.

Esto es debido al driver de intel que agrega una funcionalidad llamada DPST. Al deshabilitar esa opcion se arregla el problema. En mi caso al correr esta herramienta, lo logre deshabilitar: https://github.com/orev/dpst-control