Skip to content

Instantly share code, notes, and snippets.

View tamakiii's full-sized avatar

Daichi Tamaki tamakiii

  • undefined
  • Shibuya, Tokyo, Japan
  • X @tamakiii
View GitHub Profile

Note

# https://access.redhat.com/ja/solutions/395763
yumdownloader yum-utils
rpm -qlp yum-utils-1.1.31-46.amzn2.0.1.noarch.rpm

# https://w.vmeta.jp/tdiary/20131030.html
repoquery --all --pkgnarrow=installed --qf="%{name}.%{arch} %{version}-%{release} %{repo}"
@tamakiii
tamakiii / README.md
Last active March 22, 2023 13:15
[poetry] virtualenv: error: argument --prompt: expected one argument

python3 -m poetry config --local virtualenvs.prompt null worked for me.

Problem is: virtualenv: error: argument --prompt: expected one argument

$ python3 -m poetry add shell-gpt
Creating virtualenv -dotfiles-vt9Uq9JI-py3.11 in /Users/tamakiii/Library/Caches/pypoetry/virtualenvs
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
                  [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip] [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest
@tamakiii
tamakiii / cdk-demo-stack.ts
Last active February 21, 2023 14:31
AWS CDK Fine-grained Assertion Test
// lib/cdk-demo-stack.ts
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
export class CdkDemoStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'MainVpc', {
@tamakiii
tamakiii / README.md
Last active December 11, 2023 05:52
GNU Make: export AWS_PROFILE with `:=`, `=` and `?=`

With export AWS_PROFILE :=

$ cat Makefile
.PHONY: test

export AWS_PROFILE := acme
export AWS_REGION := us-west-2

test:
        @echo "AWS_PROFILE=$(AWS_PROFILE) (origin: $(origin AWS_PROFILE))"
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
@tamakiii
tamakiii / README.md
Created September 12, 2022 06:26
diff Shift-JIS CSV with jq (CSV to JSON conversion)

Usage

diff -u <(sjis_csv_to_json a.csv) <(sjis_csv_to_json b.csv) | vim -R -
sed -e 's/\([├|└]──\)/\t/g' -e 's/[│| ├──| └──]/\t/g' -e 's/ //g'
--- /tmp/a.txt 2021-05-11 11:35:31.000000000 +0900
+++ /tmp/b.txt 2021-05-11 12:04:02.000000000 +0900
@@ -1,16 +1,13 @@
bash-4.2# yum search php-
Loaded plugins: ovl, priorities
amzn2-core | 3.7 kB 00:00:00
-amzn2extra-php7.4 | 3.0 kB 00:00:00
+amzn2extra-php8.0 | 3.0 kB 00:00:00
(1/5): amzn2-core/2/x86_64/group_gz | 2.5 kB 00:00:00
-(2/5): amzn
@tamakiii
tamakiii / README.md
Last active May 5, 2021 11:19
Fill package gaps between amazonlinux2 AMI and Docker image

On EC2 instance

sudo sh -c 'AMI=2.0.20210427.0 && for architecture in x86_64 aarch64; do compgen -c | xargs which 2> /dev/null | xargs rpm -qf | sed -E "s/.$(uname -m)$/.${architecture}/" | sort | uniq > packages-${AMI}.${architecture}.txt; done'

In Dockerfile, like

COPY . /tmp/amazonlinux2
RUN yum update -y && yum install -y $(cat /tmp/amazonlinux2/packages-2.0.20210427.0.$(uname -m).txt | tr "\n" ' ') && rm -rf /tmp/amazonlinux2
@tamakiii
tamakiii / compgen-c.diff
Last active May 5, 2021 11:26
ami-0d14de74618b313e2...amazonlinux:2.0.20210126.0 (docker.io)
--- /dev/fd/11 2021-05-05 18:13:16.000000000 +0900
+++ /dev/fd/13 2021-05-05 18:13:16.000000000 +0900
@@ -3,267 +3,57 @@
:
[
[[
-[ec2-user@ip-10-0-0-0 ~]$ compgen -c
]]
-__expand_tilde_by_ref
-__get_cword_at_cursor_by_ref