Skip to content

Instantly share code, notes, and snippets.

View wannaphong's full-sized avatar
🧭
out-of-time

Wannaphong Phatthiyaphaibun wannaphong

🧭
out-of-time
View GitHub Profile
@wannaphong
wannaphong / map.cs
Created January 22, 2017 12:25 — forked from huangcd/map.cs
a map function like python in C#
public static IEnumerable<TResult> Map<in TSource, TResult>(IEnumerable<TSource> sources, Func<TSource, TResult> mapper)
{
foreach (var source in sources)
{
yield return mapper(source);
}
}
@wannaphong
wannaphong / xor.py
Created January 22, 2017 05:09 — forked from stewartpark/xor.py
Simple XOR learning with keras
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD
import numpy as np
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([[0],[1],[1],[0]])
model = Sequential()
model.add(Dense(8, input_dim=2))
@wannaphong
wannaphong / container.xml
Created January 8, 2017 11:12 — forked from avinassh/container.xml
Create EPUB files with Python
<?xml version='1.0' encoding='UTF-8'?>
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles>
<rootfile media-type="application/oebps-package+xml" full-path="content.opf"/>
</rootfiles>
</container>
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import zipfile
from BeautifulSoup import BeautifulSoup, Tag # Better for HTML
from lxml import etree # Better for XML