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
tamakiii / README.md
Last active November 4, 2024 02:10
Frequently used shell commands

git

# Get the current commit hash of HEAD (the latest commit on the current branch)
git rev-parse @

# Get the current branch name (using "@" as shorthand for "HEAD" or the current branch)
git rev-parse --abbrev-ref @

# Commit with the current branch name as the commit message (useful for quick commits labeled by branch name)
git commit -m "$(git rev-parse --abbrev-ref @)"
@tamakiii
tamakiii / REAME.md
Created November 1, 2024 08:57
GitHub Actions best practices

Set timeouts

Specify timeouts in GitHub Actions to prevent prolonged tasks

timeout-minutes: 5

Catch Bash Pipe Errors

Define the default shell as Bash in the workflow settings, enabling pipefail to detect errors during piping.

defaults:
@tamakiii
tamakiii / README.md
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

all:
        @echo AWS_PROFILE=$(origin AWS_PROFILE)
 @echo AWS_REGION=$(origin AWS_REGION)
@tamakiii
tamakiii / AndroidManifest.xml
Created October 21, 2023 08:07
com.oculus.browser_26.3.0.13.55.467458615-336800267_minAPI25(arm64-v8a)(nodpi)_apkmirror.com
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="33" android:compileSdkVersionCodename="13" package="com.oculus.browser" platformBuildVersionCode="33" platformBuildVersionName="13">
<uses-feature android:glEsVersion="0x00020000"/>
<uses-feature android:name="oculus.software.overlay_keyboard" 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
tamakiii / README.md
Created May 16, 2023 01:13
Install VisualStudio Code Insiders with Homebrew

https://github.com/Homebrew/homebrew-cask-versions/blob/master/Casks/visual-studio-code-insiders.rb

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
tamakiii / README.md
Last active July 1, 2024 08:55
Use GNU commands on macOS

coreutils

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
tamakiii / README.md
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
tamakiii / README.md
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
tamakiii / docker-build-heredoc.md
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 https://rpm.nodesource.com/setup_18.x | bash -
EOF

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}"