Skip to content

Instantly share code, notes, and snippets.

@chuck-park
chuck-park / AWS cognito - forgot password lambda function example
Last active April 25, 2019 10:38
AWS cognito - forgot password lambda function example
exports.handler = function(event, context) {
const VerifyEmailString = '<html>some html</html>'
let triggerSource = event.triggerSource;
if(triggerSource === "CustomMessage_SignUp" || triggerSource === "CustomMessage_ResendCode") {
let emailLink = `${process.env.DOMAIN}${process.env.VERIFY_EMAIL_ROUTE}?email=${event.request.userAttributes.email}&confirmationCode=${event.request.codeParameter}`;
event.response.emailSubject = "Verify your Account";
event.response.emailMessage = VerifyEmailString.replace(/{{PLACEHOLDER_LINK}}/g, emailLink);
# 함수
def verbose(func):
def new_func():
print "Begin", func.__name__
func();
print "End", func.__name__
return new_func
@verbose # my_function = verbose(my_function)
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(60000, 784).astype('float32') / 255.0
X_test = X_test.reshape(10000, 784).astype('float32') / 255.0
Y_train = np_utils.to_categorical(Y_train)
Y_test = np_utils.to_categorical(Y_test)
import scipy
import numpy
import matplotlib
import pandas
import sklearn
import pydot
import h5py
import theano
import tensorflow

[공통] 마크다운 markdown 작성법

1. 마크다운에 관하여

1.1. 마크다운이란?

Markdown은 텍스트 기반의 마크업언어로 2004년 존그루버에 의해 만들어졌으며 쉽게 쓰고 읽을 수 있으며 HTML로 변환이 가능하다. 특수기호와 문자를 이용한 매우 간단한 구조의 문법을 사용하여 웹에서도 보다 빠르게 컨텐츠를 작성하고 보다 직관적으로 인식할 수 있다. 마크다운이 최근 각광받기 시작한 이유는 깃헙(https://github.com) 덕분이다. 깃헙의 저장소Repository에 관한 정보를 기록하는 README.md는 깃헙을 사용하는 사람이라면 누구나 가장 먼저 접하게 되는 마크다운 문서였다. 마크다운을 통해서 설치방법, 소스코드 설명, 이슈 등을 간단하게 기록하고 가독성을 높일 수 있다는 강점이 부각되면서 점점 여러 곳으로 퍼져가게 된다.

1.2. 마크다운의 장-단점

1.2.1. 장점

String src3 = "{\"default\" : [{\"age\":10, \"name\":\" young eyeballs\"}, {\"age\":20, \"name\":\"old eyeballs\"}]}";
Gson gson = new Gson();
Model3 m3 = gson.fromJson(src3, Model3.class);
Log.d(TAG,"Json parseing: " + m3.mDefault.get(0).name);
/* reading with for loop */
// for (Model1 mo: m3.mDefault) {
// Log.d(TAG,"Json parseing: " + mo.name);
// }
@chuck-park
chuck-park / sampleREADME.md
Created October 29, 2018 14:07 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

Here is a shorter notation for initializing a list of lists:
matrix = [[0]*5 for i in range(5)]
Unfortunately shortening this to something like 5*[5*[0]] doesn't really work
because you end up with 5 copies of the same list, so when you modify one of them they all change,
for example:
>>> matrix = 5*[5*[0]]
>>> matrix
[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
@chuck-park
chuck-park / PhonecallReceiver.java
Created October 23, 2018 13:45 — forked from ftvs/PhonecallReceiver.java
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
# add new column with zeros
test_dic = {'a':[1,2], 'b':[2,3], 'c':[3,4]}
test_df = pd.DataFrame(data=test_dic)
sLength = len(test_df['a'])
test_df['d'] = pd.Series(np.zeros(sLength), index=test_df.index)
print(test_df)
'''
result