npm package , version & publish

※http://localhost:4873がrepositoryの場合 version # v1.0.1 -> v2.0.0 $ npm version major --registry # v1.0.1 -> v1.1.0 $ npm version minor --registry http://ocalhost:4873 # v1.0.1 -> v1.0.2 $ npm version patch --registry http://ocalhost:487…

highlight.js React Typescript (version: 10.4.1)

はじめに react-highlight.jsがv10に対応していなかったので, highlight.js v10でComponentを作成 なぜかvue.jsはPluginがある、、、vuePlugin bvaughn.github.io npm install 2020/12/03 latest version -> 10.4.1 $ npm i highlight.js $ npm i @types/hig…

HEIC magic number

binary dataからHEIF/HEIC形式かどうか判定する方法(memo) 背景 S3からgetObjectした画像がReactで表示されなかった heic2anyというlibraryで画像でheicをに設定可能だが、処理が重いので、APIからcontentTypeを適切に渡してあげたかった (無理やりjpgにren…

react-ga [demo] npm ERR! notarget No matching version found for react-router-dom@4.4.0.

github.com demo fileを $ npm install した時のerror 対処方法 package.jsonの以下を削除 "react-router": "4.4.0", "react-router-dom": "4.4.0", $ npm install manual install : react-router-dom www.npmjs.com $ npm install --save react-router-dom …

base64 to blobURL

const raw = window.atob(base64); const rawLength = raw.length; const blobArray = new Uint8Array(new ArrayBuffer(rawLength)); for (let i = 0; i < rawLength; i++) { blobArray[i] = raw.charCodeAt(i); } const blob = new Blob([blobArray], {type…

Cannot resolve symbol '***' in POM.xml

はじめに POM.xmlのErrorの解決方法のmemo IntelliJ IDEA tree ├── pom.xml ├── src │ ├── main │ │ ├── filters │ │ │ └── dev.properties POM.xml <project ...> 略 <profiles> <profile> <id>dev</id> <properties> <foo>src/main/filters/dev.properties</foo> </properties> </profile> </profiles> <build> <filters> <filter>${f…</filter></filters></build></project>

Java String to Unicode

memo private void stringToUnicode(String s) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < original.length(); i++) { sb.append(String.format("\\u%04X", Character.codePointAt(original, i))); } String unicode = sb.toString(); …

dockerでMySqlを起動 

とりあえず、localにDBが欲しい場合のメモ $ docker pull mysql # 起動 $ docker run --name mysql -e MYSQL_ROOT_PASSWORD=<任意password> -d -p 3306:3306 mysql # 接続 $ mysql -h 127.0.0.1 -u root -p Enter password: <任意password>

shellで日時をprintする

日時分までの文字列が必要だったので、メモ $ date '+%Y%m%d%R' | tr -d : 202001211357 gitのtagで使いたかった。 trコマンドについて tr -d <stringA> stringAを削除してくれる tr <stringA> <stringB> stringAをstringBに置き換える</stringb></stringa></stringa>

terminalでhit countを表示したい

$ grep -c で可能 docker imagesのcountを調べる場合は $ docker images -q | grep -c '' -q, --quiet Only show numeric IDs

ファイル選択させて画像表示する

参考リンク ja.reactjs.org 概要 ファイル選択ボタン, 画像表示エリアを用意 ファイル選択アクションで画像を表示する React Appの新規作成 $ npx create-react-app my-react-app 表示するComponentを作成 FileUpload.js import React, { Component } from '…

Translating SQLException with SQL state '42000', error code '1064', message [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,

予約語をcolumnに使った場合はバッククウォートで囲わないとダメ ### Translating SQLException with SQL state '42000', error code '1064' ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax;…

This XML file does not appear to have any style information associated with it. The document tree is shown below.

S3のバケットポリシーが未設定の場合、閲覧できない様子

docker のnoneイメージを一括で削除するコマンド

$ docker image rm $(docker images -a | grep none | awk '{print$3}')

Mac Medisを使う

git clone https://github.com/luin/medis.git && cd medis npm install npm run-script build npm start

There is no tracking information for the current branch.

Git pullした時にremoteブランチに関連付けできていない場合に表示される。 確認 $ git branch -vv * master b3384d7 first commit 設定 masterブランチをorigin/masterに設定する例 $ git branch --set-upstream-to=origin/master master Branch 'master' s…

Gitlab-runnerで正規表現が使える

.gitlab-ci.yml stages: - build build: stage: build script: - echo "Hello World!" only: - /^dev/ tags: - testbuild gitでtagを付与してpushすることでpipelineが生成されるようになる。 上記の例だと、"dev"から始まるtagが対象

Action: Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

*************************** APPLICATION FAILED TO START *************************** Description: Field sampleInterface in ******** required a single bean, but 3 were found: - oneExecutor: defined by method 'oneExecutor' in class path resou…

docke stop all

docker stop $(docker ps -q)

EC2インスタンスのボリュームが増えない場合はresizeする

コンソール画面でvolume増設したら、以下のコマンドを実行する $ sudo resize2fs /dev/xvda1 余っているvolumeをよしなに割り当てる

systemctl 自動起動

メモ 自動起動確認 $ systemctl is-enabled <service> 自動起動 $ sudo systemctl enable <service></service></service>

Git 特定folderに変更があったか調べる

git diff HEAD~ --name-only | grep folderName

Gitlab runner unregister ERROR

> sudo gitlab-runner unregister -t hogehoge********* Runtime platform arch=amd64 os=linux pid=27680 revision=de7731dd version=12.1.0 Running in system-mode. ERROR: Unregistering runner from GitLab error runner=hogehoge status=only http or …

React native login form

https://www.bootdey.com/react-native-snippet/9/Login-form-ui-example

React-native * Expo

facebook.github.io expo init AwesomeProject cd AwesomeProject npm start # you can also use: expo start Lan 同一ネットワーク Tunnel 他のネットワーク ★これ使った。

vim

vimコマンド メモ # 行番号表示 :set number # 行番号非表示 :set nonumber # autoインデントなしでpaste :set paste

UUIDをterminalで生成

$ uuidgen 164AA7BB-70B8-4F27-B460-84402C309BF5

golangでS3からGetObjectする

はじめに github.com/aws/aws-sdk-go このsdkを使ったs3オブジェクトの取得を行うサンプルコードです。 sample package main import ( "fmt" "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go…

AWS EC2のSSH接続

接続に必要な秘密鍵が必要です。***.pem .pemに権限を付与しておきます。 $ chmod 600 ***.pem SSH接続 $ ssh -i ***.pem ec2-user@ec2-**-***-***-***.ap-northeast-a.compute.amazonaws.com おわり

javaのversionを切り替える

shinsuke789.hatenablog.jp