Skip to content

Instantly share code, notes, and snippets.

View tokisakiyuu's full-sized avatar
🏠
Working from home

Yuu tokisakiyuu

🏠
Working from home
View GitHub Profile
@tokisakiyuu
tokisakiyuu / package.json
Created March 2, 2025 08:06
My Prettier Configurtion
{
"prettier": {
"useTabs": false,
"semi": false,
"singleQuote": true,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"bracketSpacing": true,
"arrowParens": "avoid",
"trailingComma": "all",
@tokisakiyuu
tokisakiyuu / README.md
Last active December 4, 2024 08:56
Transfer all data to another host with Mongodb (mongodump + mongorestore)

Dump (export data)

mongodump --db=example \                                                                                      
  --out=example-dump \                                                                                        
  --uri="mongodb://user:[email protected]:27017/?authSource=admin&directConnection=true"
mongodump --db= --out= --uri=""
@tokisakiyuu
tokisakiyuu / README.md
Last active November 14, 2024 15:23
Inserting, deleting and updating elements on an array of infinite length

IMG_B1D0F6413CDB-1

@tokisakiyuu
tokisakiyuu / README.md
Created September 28, 2024 12:39
Merge multiple repos into one monorepo (keep commits history)

Steps

Create Root

mkdir scribo-monorepo
cd scribo-monorepo

Define the workspace

@tokisakiyuu
tokisakiyuu / README.md
Last active August 16, 2024 15:59
Downloading Docker Images from Docker Hub without using Docker

The usage syntax for the script is given by the following:

bash download-frozen-image-v2.sh ubuntu ubuntu:latest

The image can then be imported with tar and docker load:

tar -cC 'target_dir' . | docker load
version: '3.7'
services:
mongodb_container:
# This image automatically creates a replica set required for transactions
image: prismagraphql/mongo-single-replica:4.4.3-bionic
# image: prismagraphql/mongo-single-replica:5.0.3
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: prisma
INIT_WAIT_SEC: 3
@tokisakiyuu
tokisakiyuu / Explain.tsx
Last active October 22, 2023 14:09
A ball that moves smoothly with the cursor (canvas ver)
import { FC, useEffect, useState } from 'react'
import { Stage, Layer, Circle, Arrow } from 'react-konva'
import Konva from 'konva'
import { useWindowSize } from 'react-use'
// https://konvajs.org/api/Konva.html
// https://github.com/konvajs/react-konva
interface Props {
debug?: boolean
@tokisakiyuu
tokisakiyuu / README.md
Last active August 12, 2023 16:01
Simple solution for reuse external script in tampermonkey

示例 index.html:

<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <title>Nano Require Example</title>
  <!-- @document-start inserts  -->
 
@tokisakiyuu
tokisakiyuu / csv-to-json.ts
Created July 1, 2023 02:05
Conversion between csv and json (holds the data type).
import * as csv from 'fast-csv'
/**
* `json object` => `csv string`
*
* the important thing is this process will holds the data type.
* @example
* ```js
* [
* { name: 'Jim', age: 19 },
@tokisakiyuu
tokisakiyuu / github-repo-rw.ts
Created July 1, 2023 01:47
read/write to the github repository
import { LRUCache } from 'lru-cache'
import { graphql, GraphqlResponseError } from '@octokit/graphql'
interface FileChanges {
additions?: AdditionChange[]
deletions?: DeletionChange[]
}
interface AdditionChange {
path: string