Skip to content

Instantly share code, notes, and snippets.

View nhasbun's full-sized avatar

Nicolas Hasbun nhasbun

  • Santiago, Chile
View GitHub Profile
@nhasbun
nhasbun / clasificarKMEANS.m
Last active May 19, 2016 04:10
Classification using KMeans clustering
function [resultado]=clasificar(muestra, centroides)
%%
% muestra de n X no_caracteristicas
% centroides de no_clases X no_caracteristicas
%% Clasificacion de muestras
% segun clustering usando KMEANS.
% Se requiere centroides eiquetados previamente
% es decir, un resultado 1 equivale a la clase 1
@nhasbun
nhasbun / fftsinglesideband.m
Created May 23, 2016 21:00
Single Side Band FFT for Matlab
function [resultado n]=fftsinglesideband(senal);
%% Funcion que retorna una FFT de Single Side
% ademas retorna n, la cantidad de puntos
% considerados para la FFT
% set de frecuencias se puede generar
% usando
% frecuencias =SAMPLING*(0:(n/2))/n;
@nhasbun
nhasbun / __project.sublime-project
Created October 10, 2017 18:39
Sublime text project file for Verilog
{
"folders":
[
{
"file_include_patterns":
["*.v"],
"path": "."
}
]
}
@nhasbun
nhasbun / debouncer.v
Created November 1, 2017 08:18
Debouncer genérico en Verilog
/**
Descripcion,
Modulo debouncer generico
-----------------------------------------------------------------------------
Author : Nicolas Hasbun
File : debouncer.v
Create : 2017-11-01 05:16:35
Editor : sublime text3, tab size (2)
-----------------------------------------------------------------------------
@nhasbun
nhasbun / clean_ad_association.bat
Created February 23, 2019 03:47
Clean some invasive Altium Designer file associations.
@echo off
rem Altium Designer is quite invasive regarding file associations taking control all over the place.
rem This script put some stuff in place.
rem
rem assoc and ftype can be run standalone to get a list if you need to clean
rem more associations...
@echo on
assoc .asm=
assoc .c=
@nhasbun
nhasbun / useful_c_macros.h
Created June 10, 2019 20:06
Collection of useful C macros
#define BIT(x,n) (((x) >> (n)) & 1)
#define INSERT_BITS(original, mask, value, num) (original & (~mask)) | (value << num)
#ifdef __ASSEMBLY__
#define CAST(type, value) value
#else
#define CAST(type, value) ((type)(value))
#endif
@nhasbun
nhasbun / Makefile
Created May 14, 2018 04:31 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@nhasbun
nhasbun / *pycharm-setup-2019.3.md
Created July 20, 2020 23:05 — forked from rszeto/*pycharm-setup-2020.3.2.md
Setting up PyCharm project with remote interpreter

Setting up PyCharm project with remote interpreter

Setting up a remote interpreter on PyCharm is awfully unintuitive. I've pared it down to what I think is the minimal number of steps, and leaves the fewest number of deployment configurations and Python interpreters lying around. This is designed for my specific configuration (specifically PyTorch); adapt as needed.

Configuring default project (only do after installing PyCharm for the first time):

  1. (Optional) Add virtual environment path to excluded files
    1. From Welcome Page, go to Configure > Settings > Build, Execution, Deployment > Deployment > Options
    2. Add virtualenv path. For example, if you always have the project's virtualenv in .env, add ";.env" to the "Exclude items by name" field
@nhasbun
nhasbun / msys2-here-uninstall.reg
Created September 25, 2020 04:39 — forked from elieux/msys2-here-uninstall.reg
MSYS2 here context menu items
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\MSYS here]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\MINGW64 here]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\MINGW32 here]
@nhasbun
nhasbun / telnet.py
Created April 27, 2022 15:49 — forked from pedrominicz/telnet.py
Extremely simple Telnet server in Python.
#!/usr/bin/env python3
import socket
# Connect to the server with `telnet $HOSTNAME 5000`.
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setblocking(False)
server.bind((socket.gethostname(), 5000))
server.listen(5)