Skip to content

Instantly share code, notes, and snippets.

View enokawa's full-sized avatar

Naoto Enokawa enokawa

View GitHub Profile
@enokawa
enokawa / tweetstream_dynamodb.rb
Created October 12, 2014 16:13
DynamoDBにtweetstreamでリアルタイムにツイートを格納したい
require 'aws-sdk-core'
require 'tweetstream'
TweetStream.configure do |config|
config.consumer_key = "your_twitter_consumer_key"
config.consumer_secret = "your_twitter_consumer_secret_key"
config.oauth_token = "your_twitter_access_token"
config.oauth_token_secret = "your_twitter_access_token_secret"
config.auth_method = :oauth
end
@enokawa
enokawa / rt_count.rb
Created December 3, 2014 20:54
Twitterのretweet_countをUPDATE(MySQL)
require 'twitter'
require 'mysql2'
TW_CONSUMER_KEY = ENV["TWCK"]
TW_CONSUMER_SECRET = ENV["TWCS"]
TW_ACCESS_TOKEN = ENV["TWAT"]
TW_ACCESS_TOKEN_SECRET = ENV["TWATS"]
twClient = Twitter::REST::Client.new do |config|
config.consumer_key = TW_CONSUMER_KEY
#!/bin/bash
APPLICATIONNAME="YourApplicationName"
GROUPNAME="YourApplicationGroupName"
BUCKETNAME="YourBucketName"
REGION="ap-northeast-1"
DIR="/path/to/your/deploy/dir/"
ZIPNAME="app.zip"
# S3にzipをpushする
@enokawa
enokawa / specific-bucket-policy.json
Created February 26, 2016 17:34
特定S3のみにアクセス許可を与えるIAMポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "StmtXXXXXXXXXXXXXX",
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::your_s3_bucket_name",
"arn:aws:s3:::your_s3_bucket_name/*"
@enokawa
enokawa / source-ip-restriction-policy.json
Last active March 4, 2016 17:25
IP制限IAMポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "StmtXXXXXXXXXXX",
"Effect": "Allow",
"Action": "ec2:*",
"Resource": "*"
},
{
@enokawa
enokawa / change-password.json
Last active March 4, 2016 17:25
IAMのパスワード変更ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1XXXXXXXXXXXXX",
"Effect": "Allow",
"Action": [
"iam:ChangePassword"
],
"Resource": [
[root@rhel ~]# vim /etc/sysctl.conf
[root@rhel ~]#
[root@rhel ~]# cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1XXXXXXXXXXXXX",
"Effect": "Allow",
"Action": [
"rds:DescribeDBLogFiles",
"rds:DownloadDBLogFilePortion"
],
@enokawa
enokawa / SpecificHostedZoneChange.json
Created September 7, 2016 11:57
特定のRoute53のHostedZone変更権限IAMポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
$ openssl genrsa 2048 > server.key
$ openssl req -new -key server.key > server.csr
$ openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt