Skip to content

Instantly share code, notes, and snippets.

View sawadashota's full-sized avatar

sawadashota sawadashota

View GitHub Profile
@sawadashota
sawadashota / install-docker.sh
Created February 9, 2020 14:09
Install docker and docker-compose at Ubuntu 19.04
set -eux
sudo apt -y upgrade
# Install docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge test"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
### Keybase proof
I hereby claim:
* I am sawadashota on github.
* I am sawadashota (https://keybase.io/sawadashota) on keybase.
* I have a public key ASBU1eDKmk3XUqwNQGXK1TXEOMUqiqwb4393zF3_pbNnoQo
To claim this, I am signing this object:
@sawadashota
sawadashota / LambdaBasicAuthIndex.js
Created September 4, 2018 04:34
Lambdaで index.htmlにアクセスさせ、ベーシック認証をかける
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'usename';
const authPass = 'pass';
@sawadashota
sawadashota / ScalaTest.scala
Created February 10, 2018 12:27
Scalaのテスト
import org.scalatest._
class ScalaTest extends WordSpecLike with MustMatchers {
"Title" must {
"description" in {
assert(true)
}
}
}
@sawadashota
sawadashota / docker_circleci_config.yaml
Last active February 1, 2018 01:13
Build docker image
# Please set env
# OWNER : Docker Hub owner
# IMAGE_NAME : Docker Hub image name
# DOCKER_USER : Username for login Docker Hub
# DOCKER_PASS : Password for login Docker Hub
alias:
default_env: &default_env
docker:
- image: circleci/golang:1.9.3
@sawadashota
sawadashota / codedeploy.sh
Created January 27, 2018 05:06
Codedeployを使ってデプロイする
#!/usr/bin/env bash
set -eux
if [ $# -ne 6 ]; then
echo "Invalid args"
echo "./codedeploy.sh [APPLICATION_NAME] [DEPLOYMENT_GROUP] [S3_BUCKET] [S3_REGION] [S3_KEY] [SOURCE]"
exit 1
fi
@sawadashota
sawadashota / github_assets.sh
Created January 27, 2018 05:05
GitHubのリリースのassetsにアップロードする
#!/usr/bin/env bash
set -eux
if [ $# -ne 5 ]; then
echo "Invalid args"
echo "./github_assets.sh [GITHUB_ACCESS_TOKEN] [USERNAME] [REPO_NAME] [TAG_NAME]"
exit 1
fi
@sawadashota
sawadashota / echo.c
Created December 24, 2017 12:54
echoするだけの関数
void echo(char * s) {
int length = sizeof(s);
for(int i = 0; i < length - 1; i++) {
printf("%c", s[i]);
}
printf("\n");
}
cat /var/log/httpd/access_log | grep -F '18/Dec/2017:15:10' | awk -F' ' '{printf "%-15s %s %s %-5s %s %s %-30s %s\n", $1, $4, $5, $6, $8, $9, $7, $11}'
<?php
interface aInterface
{
public function a();
}
interface bInterface extends aInterface
{
public function b();