Skip to content

Instantly share code, notes, and snippets.

View jsantanders's full-sized avatar
🎯
Focused

Jesus Santander jsantanders

🎯
Focused
View GitHub Profile
@jsantanders
jsantanders / questioner.md
Created March 17, 2023 17:12
gpt-4-spanish

$IDIOMA = Ingles

Tu eres mi profesor de $IDIOMA. Tu trabajo es enseñarme $IDIOMA siguiendo las siguientes reglas:

  1. Por defecto hazme preguntas en $IDIOMA, a las cuales yo voy a responder en $IDIOMA. Continua haciéndome preguntas si yo te digo “sigue” o “continua” o similar, entonces procedes a volver a hacerme preguntas.

  2. Si ves que mi respuesta contiene errores gramaticales, debes inmediatamente corregirme. Cuando me corrijas, por favor, di, “CORRECCIÓN: [versión correcta de lo que dije en Ingles]” Y siguen diciendo: “EXPLICACIÓN: [explicación de porque mi versión era incorrecta]”. Esta regla tiene prioridad sobre cualquier otra regla.

  3. Algunas veces no sabré como decir alguna que otra frase o palabra en $IDIOMA. En este caso voy a usar llaves “{}” para decir la frase en Español. Cuando me veas hacer esto, inmediatamente provee asistencia traduciendo lo que esta dentro de las llaves a $IDIOMA diciendo: “TRADUCCIÓN: [mi frase en español] => [tu traducción en $IDIOMA]” . Luego escribe la frase complet

@jsantanders
jsantanders / main.js
Created January 25, 2023 19:08
Curebase - technical interview- solution - Jesus Santander.
/**
* This function determines if a given array input is a valid 'Montain number'
* @param {number[]} arr the input array
* @returns {boolean} True if is valid
*/
const isValidMountainArray = (arr) => {
let isIncreasing = true;
let isDecreasing = false;
if(arr.length < 3) return false;
@jsantanders
jsantanders / animateConvolutionD.m
Created December 15, 2016 15:45
Matlab animate discrete convolution
clc
clear
pause on
filename = '/INSERT/YOUR/PATH/conv.gif';
x=[0 1 2111.4 GB 3 4 3 2 1 0]; %f signal
h=[1 1 1 1 1 1 1 1 ]; %g signal
m=length(x);
n=length(h);
%invierte el vector h
hi=fliplr(h);
@jsantanders
jsantanders / altimetro.c
Created November 27, 2016 03:43
MikroC code for MPX4115 sensor and PIC18F4550
/****************************************************************
'* Nombre : Altimetro.c *
'* Autores : I. Franchi, J. Santander *
'* Fecha : 03-06-2015 *
'* Version : 1.0 *
'* MCU : PIC18F4550 *
'* Módulos : MPX4115, TERMOCUPLA, LCD *
'****************************************************************/
#include <math.h>
@jsantanders
jsantanders / mod2.py
Created November 27, 2016 03:35
module 2 division, python implementation.
binCrcGen = [1, 0, 0, 1]
s=0b1101010010111
binPayload = [int(d) for d in str(bin(s))[2:]]
while len(binCrcGen) <= len(binPayload) and binPayload:
if binPayload[0] == binCrcGen[0]:
del binPayload[0]
for j in range(len(binCrcGen)-1):
binPayload[j] ^= binCrcGen[j+1]
@jsantanders
jsantanders / CRC16.py
Created November 27, 2016 03:33
CRC16 python class and implementation.
import random
class CRC16:
#codificacion de bits basado en el estandar CRC-12
def __init__(self, word):
self.word = word
print("La trama a transmitir es:\n", bin(int(self.word,2)))
G = 0b11000000000000101 #Polinomio generador G(x)
def mod2(self,data):
@jsantanders
jsantanders / crc.m
Created November 27, 2016 03:24
cyclic redundancy check MATLAB implementation
function CRC = mod2 (word, G)
m = zeros (1,length(G));
wordext = [word m];
while length (G) <= length (wordext)
for i = 1:length(G)
wordext(i) = xor(wordext(i),G(i));
end
while wordext(1) == 0
@jsantanders
jsantanders / digitalFilter.m
Created November 27, 2016 03:20
Matlab code for digital filter example with Handel audio.
load handel.mat
y = y';
Wp = 1000/Fs; %%Frecuencia de corte normalizada
Ws = 2000/Fs; %%Frecuencia de atenuación normalizada
[n,Wn] = buttord(Wp,Ws,3,60); %%orden de butterworth
[b,a] = butter(n,Wn,'low'); %%coeficientes de butterworth
yh = filter(b, a, y); %%Filtro de la señal
L=length(y);
NFFT = 2^nextpow2(L); % Siguiente potencia de 2 del vector y
f = Fs/2*linspace(0,1,NFFT/2+1);