Skip to content

Instantly share code, notes, and snippets.

@sandabu
sandabu / Example.php
Last active February 7, 2022 12:14
Stripe API Japanese Error Messages
<?php
//Composerでstripe/stripe-php をrequire済み
require_once __FILE__. './jp.php';
try{
Stripe\Stripe::setApiKey('sk_test_YOUR_KEY');
Stripe\Charge::create([]);
}catch(Stripe\Error\Base $e) {
$err = $e->getJsonBody()['error'];
if(key_exists('code', $err)) {
@lukovkin
lukovkin / multi-ts-lstm.py
Last active November 25, 2022 16:23
Time series prediction with multiple sequences input - LSTM - 1
# Time Series Testing
import keras.callbacks
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dense, Dropout
from keras.layers.recurrent import LSTM
# Call back to capture losses
class LossHistory(keras.callbacks.Callback):
def on_train_begin(self, logs={}):
self.losses = []
@Nemitek
Nemitek / keras_prediction.py
Created October 22, 2015 04:11
Predicting sequences of vectors (regression) in Keras using RNN - LSTM (original by danielhnyk.cz) - fixed for Keras 0.2.0
import pandas as pd
from random import random
flow = (list(range(1,10,1)) + list(range(10,1,-1)))*1000
pdata = pd.DataFrame({"a":flow, "b":flow})
pdata.b = pdata.b.shift(9)
data = pdata.iloc[10:] * random() # some noise
import numpy as np
@hnykda
hnykda / keras.py
Last active June 15, 2023 04:11
Tada's usage (see discussion)
""" From: http://danielhnyk.cz/predicting-sequences-vectors-keras-using-rnn-lstm/ """
from keras.models import Sequential
from keras.layers.core import TimeDistributedDense, Activation, Dropout
from keras.layers.recurrent import GRU
import numpy as np
def _load_data(data, steps = 40):
docX, docY = [], []
for i in range(0, data.shape[0]/steps-1):
docX.append(data[i*steps:(i+1)*steps,:])
@voluntas
voluntas / shiguredo_product_ strategy.rst
Last active April 16, 2024 13:24
時雨堂を支える製品戦略
@kelindar
kelindar / CoreOS ECS VPC
Last active January 18, 2016 12:15
CoreOS Cloud Formation with VPC and Amazon EC2 Container Service (ECS)
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Misakai CoreOS Cluster for EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings" : {
"RegionMap" : {
"eu-central-1" : {
"AMI" : "ami-3a093a27"
},
@staltz
staltz / introrx.md
Last active October 2, 2024 10:54
The introduction to Reactive Programming you've been missing
@kawasima
kawasima / 0_概要
Last active April 19, 2019 03:11
Struts1脆弱性の検証 [S2-020]
今回の問題は、StrutsでHttpリクエストパラメータをFormに入れる際に、commons-beanutilsの
BeanUtils.populateを使っていることに起因する。
populateの中で使われている、BeanUtils.setPropertyはノーチェックでBeanのプロパティを探すので、
プロパティ名を"class.classLoader.xxx"のように書いておくと、BeanのgetClassをよんで、
ClassオブジェクトのgetClassLoaderをよんで、…と連鎖してクラスローダが取得される。
そしてドットでつないだ最後のプロパティ名で値をセットにいくので、TomcatのWebAppClassLoaderが
途中でゲットされてしまうと、Struts2の脆弱性と同じ問題が発生してしまう。
@gakuzzzz
gakuzzzz / 1_.md
Last active August 2, 2023 01:59
Scala の省略ルール早覚え

Scala の省略ルール早覚え

このルールさえ押さえておけば、読んでいるコードが省略記法を使っていてもほぼ読めるようになります。

メソッド定義

def concatAsString(a: Int, b: Int): String = {
  val a_ = a.toString();
  val b_ = b.toString();
@voluntas
voluntas / shiguredo_recruit.rst
Last active September 25, 2024 04:48
時雨堂を支える採用