This file contains hidden or 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
#!/bin/sh -eu | |
# 2023-10-20 | |
# VSCodeでJupyter使うと死ぬようになったので、動いていたころのバージョンにもどして対処した。 | |
# 見ればわかるとおり3.10用だけど、ちょっと変えればよそでも動く。 | |
PIP3="python3.10 -m pip" | |
$PIP3 install --user -U pip | |
hash -r |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
#!/bin/bash -ue | |
# プロジェクトのトップで実行し、1個上のフォルダにzipを作る | |
git archive --format=zip HEAD -o "../${PWD##*/}.zip" |
This file contains hidden or 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
function getLocalISOWithTZ(date) { | |
const tzOffset = date.getTimezoneOffset(); | |
const absOffset = Math.abs(tzOffset); | |
const tzSign = tzOffset >= 0 ? "-" : "+"; | |
const tzHours = String(Math.floor(absOffset / 60)).padStart(2, "0"); | |
const tzMinutes = String(absOffset % 60).padStart(2, "0"); | |
const adjustedDate = new Date(date.getTime() - tzOffset * 60 * 1000); | |
const isoString = adjustedDate.toISOString(); | |
const dateString = isoString.slice(0, 10); | |
const timeString = isoString.slice(11, 19); |
This file contains hidden or 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
// AWS Cognitoでクライアントシークレットを設定したときの、 | |
// SECRET_HASHの作り方 | |
import { createHmac } from 'crypto'; | |
function generateSecretHash(clientId, secretKey, userName) { | |
const hasher = createHmac('sha256', secretKey); | |
hasher.update(userName + clientId); | |
return hasher.digest('base64'); | |
} |
This file contains hidden or 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
// ChatGPTに | |
// 「Rustで配列を逆にする関数を書いてください」と聞いて出てきたコード。 | |
// 追加で「オリジナルの配列を破壊的に逆にはできませんか?」と聞いて出てきたのが | |
// reverse_array_in_place() | |
fn reverse_array<T: Clone>(arr: &[T]) -> Vec<T> { | |
let mut reversed = vec![]; | |
for element in arr.iter().rev() { | |
reversed.push(element.clone()); | |
} |
This file contains hidden or 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 "fmt" | |
// ChatGPTに | |
// 「Go言語で配列を逆にする関数を書いてください」(この例ではスライスだけど) | |
// と聞いて出てきたコードはコンパイルできなかった。 | |
// - 出力のとこを変えた | |
// - gerenicsにしてみた (go 1.8以上) |
This file contains hidden or 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
sudo yum -y groupinstall "Development Tools" | |
sudo yum -y install openssl-devel bzip2-devel libffi-devel xz-devel jq | |
curl https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz -O | |
tar xf Python-3.9.9.tar.xz | |
cd Python-3.9.9 | |
./configure --enable-optimizations | |
sudo make altinstall | |
cd .. | |
sudo rm -rf Python-3.9.9 Python-3.9.9.tar.xz | |
sudo /usr/local/bin/python3.9 -m pip install --upgrade pip |
This file contains hidden or 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
USER1=Former21 # ←ここを好きなユーザ名に変えてください | |
aws iam create-user --user-name $USER1 | |
aws iam attach-user-policy --user-name $USER1 --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess | |
aws iam create-access-key --user-name $USER1 |
This file contains hidden or 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
#!/bin/sh -ue | |
# for RHEL8 | |
sudo dnf -y update | |
sudo dnf -y autoremove | |
sudo dnf -y remove $(dnf repoquery --installonly --latest-limit=-2 -q) | |
sudo needs-restarting -r |
NewerOlder