Skip to content

Instantly share code, notes, and snippets.

View Kcrong's full-sized avatar
🇰🇷
Smile

Henry Kim Kcrong

🇰🇷
Smile
View GitHub Profile
@Kcrong
Kcrong / main.cpp
Created May 30, 2016 01:39
neuron_ask_main
#include <iostream>
#include <ctime>
using namespace std;
void main()
{
srand((unsigned)time(NULL)); // Set random seed
Neuron* neuron = new Neuron(2, 0.1);
class A:
def __init__(self, percentage):
self.percentage = percentage
if __name__ == '__main__':
data = [A(12), A(32), A(22)]
sudo apt-get update
sudo apt-get install python-dev libffi-dev libssl-dev zlib1g-dev libncurses5-dev libsqlite3-dev -y
tar xvf Python-2.7.*.tar.xz
cd Python-2.7.*
./configure
sudo make -j 4
sudo make altinstall
which python2
from random import shuffle
tags = ['a', 'b', 'c', 'result']
def get_triangle_type(a, b, c):
if a == 90 or b == 90 or c == 90:
return "직각"
elif a > 90 or b > 90 or c > 90:
return "둔각"
elif a == b == c == 60:
@Kcrong
Kcrong / script.py
Created July 7, 2017 08:39
Excel to dict
import json
import pandas as pd
from collections import defaultdict
multi_depth_defaultdict = lambda: defaultdict(multi_depth_defaultdict)
df = pd.read_excel('category.xlsx')
data = multi_depth_defaultdict()
"""
1. main 함수에서 `async def A`를 호출 후 await 하고, 반환값을 받아 다시 `async def B`를 호출하는 방식
"""
import asyncio
from socket import socket, AF_INET, SOCK_STREAM
from keras.utils import np_utils
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Activation
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(x_train.shape[0], 784).astype('float32') / 255.0
x_test = x_test.reshape(x_test.shape[0], 784).astype('float32') / 255.0
y_train = np_utils.to_categorical(y_train)
y_test = np_utils.to_categorical(y_test)
6 148 72 35 0 33.6 0.627 50 1
1 85 66 29 0 26.6 0.351 31 0
8 183 64 0 0 23.3 0.672 32 1
1 89 66 23 94 28.1 0.167 21 0
0 137 40 35 168 43.1 2.288 33 1
5 116 74 0 0 25.6 0.201 30 0
3 78 50 32 88 31.0 0.248 26 1
10 115 0 0 0 35.3 0.134 29 0
2 197 70 45 543 30.5 0.158 53 1
8 125 96 0 0 0.0 0.232 54 1
http://tykimos.github.io/warehouse/2017-3-8_CNN_Getting_Started_handwriting_shape.zip
# Whole data
seq = ['g8', 'e8', 'e4', 'f8', 'd8', 'd4', 'c8', 'd8', 'e8', 'f8', 'g8', 'g8', 'g4',
'g8', 'e8', 'e8', 'e8', 'f8', 'd8', 'd4', 'c8', 'e8', 'g8', 'g8', 'e8', 'e8', 'e4',
'd8', 'd8', 'd8', 'd8', 'd8', 'e8', 'f4', 'e8', 'e8', 'e8', 'e8', 'e8', 'f8', 'g4',
'g8', 'e8', 'e4', 'f8', 'd8', 'd4', 'c8', 'e8', 'g8', 'g8', 'e8', 'e8', 'e4']