Skip to content

Instantly share code, notes, and snippets.

import { Connection, PublicKey, clusterApiUrl, LAMPORTS_PER_SOL, RpcResponseAndContext, AccountInfo } from "@solana/web3.js";
import { AccountLayout, TOKEN_PROGRAM_ID } from "@solana/spl-token";


// ... 省略 ...

            const getOwnedTokenAccount = async () : Promise<RpcResponseAndContext<{
                pubkey: PublicKey;
@keitaj
keitaj / lib.rs
Created April 23, 2022 03:20
Solana Program Tutorial
use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint,
entrypoint::ProgramResult,
msg,
program_error::ProgramError,
pubkey::Pubkey,
};
@keitaj
keitaj / kubernetes_troubleshooting.md
Last active October 16, 2020 00:55
Kubernetes Troubleshooting

The Service "xxx" is invalid: spec.clusterIP: Invalid value: "None": field is immutable

Because clusterIP was already created, first run kubectl delete manually, and then deploy.

kubectl delete -f deploy.yaml
kubectl apply -f deploy.yaml
@keitaj
keitaj / Dockerfile
Created February 4, 2020 12:31
Run docker container with arguments
FROM golang:1.13.7-alpine3.10
ADD . /go/src/workspace/ecs-task
WORKDIR /go/src/workspace/ecs-task
RUN go build -o ecs-task && mv ecs-task /bin
CMD /bin/sh ./entrypoint.sh
@keitaj
keitaj / Dockerfile
Created February 4, 2020 12:16
Run the executable docker container
FROM golang:1.13.7-alpine3.10
ADD . /go/src/workspace/ecs-task
WORKDIR /go/src/workspace/ecs-task
RUN go build -o ecs-task && mv ecs-task /bin
ENTRYPOINT ecs-task
@keitaj
keitaj / howtogomod.md
Created January 17, 2020 08:39
howtogomod
@keitaj
keitaj / main.go
Last active December 13, 2016 15:35
Goで書くはじめてのデジタル署名 ref: http://qiita.com/keitaj/items/00aede60e64e8eebbb8a
package main
import (
"bufio"
"bytes"
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/base64"
@keitaj
keitaj / file0.txt
Created August 14, 2016 05:35
Elasticsearchを使って自分の周囲の位置情報を検索する ref: http://qiita.com/keitaj/items/5ab59387604801cb0532
{
"mappings": {
"shop": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
@keitaj
keitaj / file0.go
Last active October 6, 2017 06:24
Go言語でstructをmapに変換する ref: http://qiita.com/keitaj/items/440a50a53c8980ee338f
package main
import (
"fmt"
"reflect"
"encoding/json"
)
func StructToMap(data interface{}) map[string]interface{} {
@keitaj
keitaj / gist:bb4f5278878e48f1dc35
Created April 12, 2015 05:19
apiで値取得
var json = (function () {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': 'http://localhost:8888/indkrydsning/app/house/stats_json/',
'dataType': "json",
'success': function (data) {
json = data;
}