Skip to content

Instantly share code, notes, and snippets.

View colltoaction's full-sized avatar

Martin Coll colltoaction

View GitHub Profile
@colltoaction
colltoaction / armbears.svg
Created November 24, 2015 04:50
I support the right to arm bears
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@colltoaction
colltoaction / pagerank-ex.py
Created December 6, 2015 22:46
PageRank exercise in Python
#!/usr/bin/env python3
"""
1. Calcular el PageRank tematico para el siguiente grafo.
. (2) <---> (1) ----> (3) <---> (4)
Asumir que los nodos que representan el tema de interes son el 1 y el 2 y que el peso del nodo 1 es el doble del tema 2. Usar b=0.7. Y luego identificar la opcion correcta entre las siguientes:
a) TSPR(1) = .2455
b) TSPR(4) = .6680
c) TSPR(1) = .3576
@colltoaction
colltoaction / link-analysis.md
Created December 7, 2015 23:04
Ejercicio de an谩lisis de links basado en el paper http://www9.org/w9cdrom/160/160.html
@colltoaction
colltoaction / DirectoryException.cpp
Created December 14, 2015 23:26
A simple C++ class that reads files in a directory, and also works as an example of RAII.
#include "DirectoryException.h"
DirectoryException::DirectoryException(const std::string& what_arg)
: std::logic_error(what_arg) {
}
@colltoaction
colltoaction / gtkmm_ovalo.cpp
Created July 5, 2016 04:18
脫valo que ocupa toda la ventana usando gtkmm
/*
Implemente una rutina (en Windows o Linux) que dibuje un 贸valo que ocupe toda la ventana.
*/
#include <gtkmm/drawingarea.h>
#include <gtkmm/application.h>
#include <gtkmm/window.h>
#include <cmath>
class Ovalo : public Gtk::DrawingArea {
@colltoaction
colltoaction / inplace-acortar.c
Last active August 2, 2017 17:35
Archivos de ejemplo de edici贸n in-place en C
/*
* Ejercicio [5] final 12/12/06
* Escribir un algoritmo ANSI C que, sin crear archivos intermedios
* altere el archivo a.txt reemplazando la secuencia '//' por '*'
* Excepto si se encuentra entre parentesis
*/
/*
* Compilar con gcc -ansi -std=gnu99 -o prueba inplace-acortar.c
*/
@colltoaction
colltoaction / resumen.md
Last active July 7, 2016 20:01
Resumen de los temas de Taller I

Temas de Taller de Programaci贸n I (75.42)

Threads

pthread

  • int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
  • int pthread_join(pthread_t thread, void **retval);
  • int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
@colltoaction
colltoaction / boot-client-aot.ts
Created October 17, 2016 17:30
Example configuration for Angular 2 AoT and Webpack 2
import "./polyfills";
import "./rxjs-operators";
import { enableProdMode } from "@angular/core";
import { platformBrowser } from "@angular/platform-browser";
import { MainModuleNgFactory } from "./components/main.aot.ngfactory"; // Ignore error
if ((<any>module)["hot"]) {
(<any>module)["hot"].accept();
(<any>module)["hot"].dispose(() => { platform.destroy(); });
@colltoaction
colltoaction / 1-Migration.cs
Created February 22, 2017 00:32
EF Core data motion proposal
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Countries",
columns: table => new
{
Name = table.Column<string>(nullable: false),
Population = table.Column<int>(nullable: false),
},
constraints: table =>
@colltoaction
colltoaction / 1-Migration.cs
Last active March 3, 2023 13:48
EF Core data motion proposal. These three examples are sequential: first we have three seed data values, then four, then we update one of them.
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Countries",
columns: table => new
{
Name = table.Column<string>(nullable: false),
Population = table.Column<int>(nullable: false),
},
constraints: table =>