Skip to content

Instantly share code, notes, and snippets.

View lirlia's full-sized avatar

gin lirlia

View GitHub Profile
@lirlia
lirlia / operations.graphql
Created September 26, 2023 00:52 — forked from duboisf/operations.graphql
Add branch protection to a repo using GitHub's Graphql API
fragment branchProtection on BranchProtectionRule {
allowsDeletions
allowsForcePushes
creator {
login
}
id
isAdminEnforced
requiredStatusCheckContexts
requiredApprovingReviewCount
// https://twitter.com/riddle_tec/status/1584562550318206978?s=20&t=gvftsUiaiGKSUe8uqvyf0g
$(function(){
$('.confetti').append('<img style="width: 50px" src="https://1.bp.blogspot.com/-LegKewUIfcU/Wmf8QN1m58I/AAAAAAABJyg/B8cia110bPkYs4krzeM2SBhm9fXhO04tgCLcBGAs/s800/money_kasoutsuuka_kusa.png">');
$('.confetti').append('<img style="width: 100px" src="https://1.bp.blogspot.com/-LegKewUIfcU/Wmf8QN1m58I/AAAAAAABJyg/B8cia110bPkYs4krzeM2SBhm9fXhO04tgCLcBGAs/s800/money_kasoutsuuka_kusa.png">');
$('.confetti').append('<img style="width: 150px" src="https://1.bp.blogspot.com/-LegKewUIfcU/Wmf8QN1m58I/AAAAAAABJyg/B8cia110bPkYs4krzeM2SBhm9fXhO04tgCLcBGAs/s800/money_kasoutsuuka_kusa.png">');
});
#!/bin/bash
CALC_FILE="$HOME/.today_meeting"
# "時間" "打ち合わせ名" "Google MeetのURL" を取得し保存します
"$(brew --prefix)/bin/gcalcli" agenda --tsv --military --nostarted --details url \
| grep "$(date +"%Y-%m-%d")" | awk '{print $2,$7,$6}' > "$CALC_FILE"
#!/bin/bash
## ❯ crontab -l
## MAILTO=""
## * * * * * $HOME/bin/tools/calendar/tell-schedule.sh 2 1> /dev/null 2> /tmp/calc.log
# 予定情報を持ってくる
$HOME/bin/tools/calendar/get-gcalc.sh
CALC_FILE=$HOME/.today_meeting
$ curl -sSL -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" | jq -r
{
"access_token": "XXX",
"expires_in": 1967,
"token_type": "Bearer"
}
name: gke-metadata-server
ports:
- containerPort: 987
hostPort: 987
name: alts
protocol: TCP
- containerPort: 988
hostPort: 988
name: metadata-server
protocol: TCP
root@pod-with-sa:/# curl -sSL -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts?recursive=true" | jq -r
{
"default": {
"aliases": [
"default"
],
"email": "gke-workload@PROJECT_ID.iam.gserviceaccount.com",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
root@pod-without-sa:/# gcloud compute instances list
ERROR: (gcloud.compute.instances.list) Some requests did not succeed:
- Internal error. Please try again or contact Google Support. (Code: '5D7E9ABBB1E1C.24CC2F7.4F022C33')
$ iptables-legacy -L -n -v -t nat
Chain PREROUTING (policy ACCEPT 2655 packets, 160K bytes)
pkts bytes target prot opt in out source destination
129M 9016M KUBE-SERVICES all -- * * 0.0.0.0/0 0.0.0.0/0 /* kubernetes service portals */
0 0 DNAT tcp -- * * 0.0.0.0/0 169.254.169.254 tcp dpt:8080 /* metadata-concealment: bridge traffic to metadata server goes to metadata proxy */ to:127.0.0.1:987
45715 2743K DNAT tcp -- * * 0.0.0.0/0 169.254.169.254 tcp dpt:80 /* metadata-concealment: bridge traffic to metadata server goes to metadata proxy */ to:127.0.0.1:988
...
apiVersion: v1
kind: Pod
metadata:
name: pod-without-sa
namespace: default
spec:
containers:
- image: gcr.io/google.com/cloudsdktool/cloud-sdk:slim
name: pod-without-sa
stdin: true