This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.9-slim | |
| ARG POETRY_VERSION="1.1.6" | |
| # Install `poetry`. | |
| ADD https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py /tmp/get-poetry.py | |
| RUN python /tmp/get-poetry.py --version "${POETRY_VERSION}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| DIRECTORIES = [ | |
| 'dir_a', | |
| 'dir_b', | |
| 'dir_c', | |
| ] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState, useEffect, useRef } from 'react' | |
| function useElementSize() { | |
| const ref = useRef(null) | |
| const [size, setSize] = useState({ | |
| width: 0, | |
| height: 0, | |
| }) | |
| useEffect(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState, useEffect } from 'react' | |
| function useWindowSize() { | |
| const [windowSize, setWindowSize] = useState({ | |
| width: null, | |
| height: null, | |
| }) | |
| useEffect(() => { | |
| const updateSize = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Simple https server for development.""" | |
| import ssl | |
| from http.server import HTTPServer, SimpleHTTPRequestHandler | |
| CERTFILE = './localhost.pem' | |
| def main(): | |
| https_server(certfile=CERTFILE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # MySQLTuner: https://github.com/major/MySQLTuner-perl | |
| # Open Bash with the container. | |
| docker exec [mariadb_or_mysql] bash | |
| # Change the working directory to `/tmp`. | |
| cd /tmp | |
| # Install wget. | |
| apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- All databases. | |
| SELECT | |
| table_schema AS `Database`, | |
| ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS `Size in MB` | |
| FROM information_schema.tables | |
| GROUP BY `Database` | |
| ORDER BY `Size in MB` DESC; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!python3 | |
| """A script to run a web server with a specified directory and port.""" | |
| import socketserver | |
| from functools import partial | |
| from http.server import SimpleHTTPRequestHandler | |
| from pathlib import Path | |
| DIRECTORY = ... | |
| PORT = 8001 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SSH キーの生成 | |
| # See: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent | |
| ssh-keygen -t ed25519 -C "your_email@example.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Script to export Firestore collection as CSV.""" | |
| import csv | |
| import sys | |
| from pathlib import Path | |
| from firebase_admin import credentials, firestore, initialize_app | |
| CRED_FILE = Path(__file__).resolve().parent / 'firebase-privateKey.json' | |
| COLLECTION_NAME = 'XXX' |