Skip to content

Instantly share code, notes, and snippets.

View momota10's full-sized avatar
🎯
Focusing

Momota Sasaki momota10

🎯
Focusing
View GitHub Profile
//split
val url = "https://play.google.com/store/apps/details?id=com.expedia.bookings&hl=ja" //sample_url
val replacedUrl = url.replace("https://", "")
val splitUrl =replacedUrl.split("/")
println(replacedUrl) //play.google.com/store/apps/details?id=com.expedia.bookings&hl=ja
println(splitUrl(0)) //play.google.com
//pattern match
splitUrl(0) match {
case "itunes.apple.com" =>
@momota10
momota10 / file0.txt
Last active December 27, 2016 05:14
Redshiftのクラスタを再構築せざるを得なかった話 ref: http://qiita.com/momotasasaki/items/6a5e23b1ccdae79c2ead
Dear Customer,
Our systems have identified a potential hardware issue that may affect your
Amazon Redshift cluster {your_cluster_name} the {your_region_name} AWS region.
As a precaution, we recommend that you restore a new cluster from a snapshot
within the next 2-3 days and delete your existing cluster.
This will automatically provision you on healthy hardware and help you
avoid an unplanned outage. Please confirm receipt of this message.
package main
import (
"fmt"
mailgun "github.com/mailgun/mailgun-go"
)
func main() {
mg := mailgun.NewMailgun(
{
"template": "elb_access_log*",
"mappings" : {
"elb_access_log" : {
"properties" : {
"backend" : {
"type" : "ip"
},
"backend_port" : {
"type" : "integer",
@momota10
momota10 / mailgun-tracking.rb
Created May 27, 2017 04:17
sample ruby code of mailgun tracking
require "time"
require 'active_support/all'
require 'rest-client'
require 'json'
def get_logs(start_time, end_time)
response = RestClient.get "https://api:key-***********"\
"@api.mailgun.net/v3/influencerone.jp/events",
:params => {
:'begin' => "#{start_time}",
import pandas as pd
df=pd.DataFrame([[1,2,3],
[10,20,30],
[100,200,300],
[1000,2000,3000],
[1000,2000,3001],
[1000,2000,3002],
[1000,2000,3003]],
columns=['A','B','C'])
def test_mail(user)
email = mail(to: "[email protected]", subject: "ようこそ")
email.mailgun_options = {tag: "test_mail_tag"}
end
from selenium import webdriver
from getpass import getpass
def login_twitter(username, password):
driver = webdriver.Firefox()
driver.get("https://twitter.com/login")
username_field = driver.find_element_by_class_name("js-username-field")
password_field = driver.find_element_by_class_name("js-password-field")
from mixpanel import Mixpanel
PROJECT_TOKEN = '******'
user_id = '1'
mp = Mixpanel(PROJECT_TOKEN)
mp.track(user_id, 'Push Test', {'property_test' : '吉祥寺井の頭公園三鷹台久我山富士見ヶ丘高井戸浜田山西永福永福町明大前東松原新代田下北沢池の上駒場東大前新泉渋谷abcdef新宿代々木原宿渋谷恵比寿目黒五反田大崎品川田町浜松町新橋有楽町東京神田秋葉原御徒町上野'})
# return '255'
@momota10
momota10 / index.js
Created April 6, 2018 09:13
sns topicに飛んで来たCloudWatchのalarmをslackに通知するためのlambda function
/*
### 前提
- slack webhookはstore parameterに保管している
- アラートの重要度ごとにhookを作る
- SEVERITYとCOLORをlambdaの環境変数に設定する
*/
const url = require('url');
const https = require('https');
const AWS = require('aws-sdk');