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
tamakiii /
Created December 11, 2023 06:05
Variable and Environment Variable in GNU Make
$ cat Makefile
.PHONY: all

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

        @echo AWS_PROFILE=$(origin AWS_PROFILE)
 @echo AWS_REGION=$(origin AWS_REGION)
tamakiii / AndroidManifest.xml
Created October 21, 2023 08:07
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="" android:compileSdkVersion="33" android:compileSdkVersionCodename="13" package="com.oculus.browser" platformBuildVersionCode="33" platformBuildVersionName="13">
<uses-feature android:glEsVersion="0x00020000"/>
<uses-feature android:name="" android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission-sdk-23 android:maxSdkVersion="30" android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission-sdk-23 android:name="android.permission.BLUETOOTH_ADVERTISE"/>
tamakiii /
Created May 16, 2023 01:13
Install VisualStudio Code Insiders with Homebrew

Run brew install homebrew/cask-versions/visual-studio-code-insiders

$ brew install homebrew/cask-versions/visual-studio-code-insiders
==> Tapping homebrew/cask-versions
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions'...
remote: Enumerating objects: 257301, done.
remote: Counting objects: 100% (22133/22133), done.
remote: Compressing objects: 100% (346/346), done.
tamakiii /
Last active July 1, 2024 08:55
Use GNU commands on macOS


The default installed commands, such as date, may not be compatible with general Linux systems.

$ date -d '+10 minutes' +%s
date: illegal option -- d
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]
tamakiii /
Created May 7, 2023 09:44
Working with credentials managed by Keychain Access in CLI on macOS

Export to Environment variable

export OPENAI_API_KEY=$(security find-generic-password -s OPENAI_API_KEY -a $(whoami) -w)

Copy to clipboard

security find-generic-password -s OPENAI_API_KEY -a $(whoami) -w | pbcopy
tamakiii /
Last active May 7, 2023 09:48
Linux Application Directory Structure

In a Linux server environment, it's best to follow the Filesystem Hierarchy Standard (FHS) for organizing files and directories. Based on the FHS, here are some common locations to consider for your application:

  1. /opt: If your application is a standalone package that doesn't interfere with the rest of the system, you can place it in /opt. This is the common place for optional or third-party software. In this case, you would put your application into /opt/{my-name}/{application-name}.

  2. /usr/local: If your application is system-wide and can be shared among multiple users, you can place it in /usr/local. This location is generally used for software that is not managed by the system's package manager. In this case, your application would go into /usr/local/{my-name}/{application-name}.

  3. /home/{user}/: If your application is intended to be used only by a specific user, you can place it in their home directory. In this case, you would put your application into `/home/{user}/{my-name}/{applica

tamakiii /
Created April 8, 2023 15:04
docker build heredoc
BUILDKIT_PROGRESS=plain docker build -t tmp -f- . <<EOF
FROM --platform=linux/amd64 amazonlinux:2017.03.1.20170812
RUN yum update -y && yum install -y ca-certificates
RUN curl -fsSL | bash -


yumdownloader yum-utils
rpm -qlp yum-utils-1.1.31-46.amzn2.0.1.noarch.rpm

repoquery --all --pkgnarrow=installed --qf="%{name}.%{arch} %{version}-%{release} %{repo}"
tamakiii /
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]
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', {