Skip to content

Instantly share code, notes, and snippets.

View jogonba2's full-sized avatar

José González jogonba2

View GitHub Profile
@jogonba2
jogonba2 / mbart_copy_generator.py
Last active December 31, 2023 18:49
MBartCopyGenerator
# coding=utf-8
# Copyright 2021, The Facebook AI Research Team and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jogonba2
jogonba2 / Simple_VAE.py
Created May 16, 2017 02:54
Example of Variational Autoencoder (Tensorflow)
import tensorflow as tf
import numpy as np
epochs = 10000
batch_size = 1500
d = 2
enc_1_hidden_units = 128
enc_2_hidden_units = 64
mean_hidden_units = std_hidden_units = 2
dec_1_hidden_units = 64
@jogonba2
jogonba2 / WattsStrogatz.py
Last active September 16, 2016 16:06
Watts-Strogatz model for generating small-words random graphs.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import random,choice
import networkx as nx
import matplotlib.pyplot as plt
import time
def watts(G,B):
@jogonba2
jogonba2 / Barabasi.py
Last active September 16, 2016 16:06
Barabasi-Albert model for generating scale-free random graphs.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import randint,random
import networkx as nx
import matplotlib.pyplot as plt
import time
# http://stackoverflow.com/questions/479236/how-do-i-simulate-biased-die-in-python #
def roll(probs):
@jogonba2
jogonba2 / SOM.py
Last active September 9, 2016 15:14
Self-organizing maps (SOM)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from sklearn.datasets import load_iris
class SOM:
def __init__(self,X,it,size_x,size_y,min_w=0,max_w=1,a=0.01):
@jogonba2
jogonba2 / A5.py
Last active November 18, 2021 16:31
A5/1 python implementation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A5.py
#
# Author: overxfl0w13
#
def header():
print """
@jogonba2
jogonba2 / DES.py
Created September 2, 2015 16:59
DES encryption
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# DES.py
#
# Author: Overxfl0w13
import binascii
@jogonba2
jogonba2 / minimax.py
Created August 26, 2015 18:22
Minimax example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# minimax.py
#
# Copyright 2015 Overxflow13
#
class Node:
@jogonba2
jogonba2 / gen.py
Last active August 29, 2015 14:25
Problemas de lógica mediante genéticos (Einstein y avenida complicada)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# genetico_logica.py
# Author: Overxfl0w13 #
from random import shuffle,randint,uniform
#from premisas_avenida import PREMISAS
from premisas_einstein import PREMISAS
MAX_PREMISES = 0
@jogonba2
jogonba2 / rafflecopter.c
Created July 20, 2015 13:27
Rafflecopter "clickjacking"
/*
* rafflecopter.c
* Overxfl0w13
* 2015
*/
#include <windows.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>