This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
# pdb | |
kubectl label pdb istiod -nistio-system app.kubernetes.io/managed-by=Helm | |
kubectl annotate pdb istiod -nistio-system meta.helm.sh/release-name=istiod meta.helm.sh/release-namespace=istio-system | |
# service account | |
kubectl label sa istiod -nistio-system app.kubernetes.io/managed-by=Helm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
# service account | |
kubectl label sa istio-reader-service-account -nistio-system app.kubernetes.io/managed-by=Helm | |
kubectl annotate sa istio-reader-service-account -nistio-system meta.helm.sh/release-name=istio-base meta.helm.sh/release-namespace=istio-system | |
kubectl label sa istiod-service-account -nistio-system app.kubernetes.io/managed-by=Helm | |
kubectl annotate sa istiod-service-account -nistio-system meta.helm.sh/release-name=istio-base meta.helm.sh/release-namespace=istio-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euxo pipefail | |
# pdb | |
kubectl label pdb istiod -nistio-system app.kubernetes.io/managed-by=Helm | |
kubectl annotate pdb istiod -nistio-system meta.helm.sh/release-name=istiod meta.helm.sh/release-namespace=istio-system | |
# service account | |
kubectl label sa istiod -nistio-system app.kubernetes.io/managed-by=Helm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; | |
use cpal::{Sample, SampleFormat, Stream}; | |
fn main() { | |
let buzzer = Buzzer::new(); | |
println!("playing..."); | |
buzzer.on(); | |
std::thread::sleep(std::time::Duration::from_secs(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"image" | |
"image/color" | |
"image/draw" | |
"image/jpeg" | |
"log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package design | |
import . "goa.design/goa/v3/dsl" | |
var _ = API("api", func() { | |
Title("sample api") | |
Server("api", func() { | |
Host("localhost", func() { URI("http://localhost:8088") }) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import tweepy | |
def create_twitter_api(): | |
consumer_key = os.getenv('TWITTER_API_KEY') | |
consumer_secret = os.getenv('TWITTER_API_SECRET') | |
access_token = os.getenv('TWITTER_ACCESS_TOKEN') | |
access_secret = os.getenv('TWITTER_ACCESS_TOKEN_SECRET') | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package slack | |
import ( | |
"bytes" | |
"encoding/json" | |
"log" | |
"net/http" | |
"net/url" | |
"os" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest.mock import MagicMock | |
from try_except_decorator import try_except | |
def test_valid(): | |
""" | |
例外が起きなかった場合にデコレートされた関数の戻り値が返ること | |
""" | |
mock_func = MagicMock(return_value='correct') # こんな感じで定義時に与えることもできます | |
result = try_except(exreturn_value='excepted')(mock_func)() # 3回の呼び出し | |
assert result == 'correct', "デコレートされた関数の戻り値が返る" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest.mock import MagicMock | |
mock_func = MagicMock() | |
mock_func.return_value = "mock return !" # 戻り値の設定 | |
mock_func.side_effect = Exception() # 例外の設定 |
NewerOlder