Skip to content

Instantly share code, notes, and snippets.

View shinshin86's full-sized avatar
👶

Yuki Shindo shinshin86

👶
View GitHub Profile
@shinshin86
shinshin86 / apply-upstream-tags.sh
Created December 4, 2023 23:36
This shell script checks If the upstream remote is present, it proceeds to fetch all tags from the upstream repository and then pushes these tags to the origin remote repository.
#!/bin/bash
# Check if the upstream repository is set
upstream=$(git remote -v | grep upstream)
# Check if the upstream repository exists
if [ -z "$upstream" ]; then
echo "The upstream repository is not set."
else
echo "Upstream repository found. Fetching and pushing tags."
@shinshin86
shinshin86 / all-update-watch-status-gh-star-project.ts
Created November 7, 2023 22:10
Script that runs in Deno to reconfigure to ignore notifications for Starred GitHub projects.
import { Octokit } from "https://esm.sh/octokit?dts";
const personalAccessToken = "YOUR_PERSONAL_ACCESS_TOKEN";
const octokit = new Octokit({ auth: personalAccessToken });
async function getStarredRepos() {
try {
const response = await octokit.paginate("GET /user/starred");
return response.map((repo) => ({
owner: repo.owner.login,
@shinshin86
shinshin86 / is-animated-gif.js
Created July 29, 2023 13:35
This is a Node.js script to check if it is an animated GIF.
(async() => {
const gifFrames = require('gif-frames');
const fs = require('fs');
const path = require('path');
const gifPath = process.argv[2];
if(!gifPath) {
console.log('Please provide an gif file as an argument');
process.exit(1);
}
@shinshin86
shinshin86 / read-sdwebui-file-metadata.js
Last active May 14, 2023 12:25
Sample Node.js to read metadata of PNG files created with Stable Diffusion web UI.
/**
* Sample Node.js to read metadata of PNG files created with Stable Diffusion Web UI
*
* Code from the following page is used as a reference
* URL: https://qiita.com/javacommons/items/472e85be1b11098172b3
*/
const fs = require('fs').promises;
async function getPngInfo(fileName) {
const signature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
@shinshin86
shinshin86 / chatgpt-conversation-downloader.js
Created January 11, 2023 13:44
ChatGPT conversation downloader
/**
* ChatGPT conversation downloader
*
* Usage:
* 1. Open the ChatGPT page.
* 2. Open the console from your browser's developer tools (DevTools for Chrome), paste this script and run it.
* 3. Next, run `download()` with the conversation you want to download selected from the history.
* 4. The conversation will then be downloaded as a text file.
* 5. The title of the text file will be the title name in the history.
*
@shinshin86
shinshin86 / chatgpt-with-qa-format.js
Created December 9, 2022 12:54
Script for displaying the conversing with ChatGPT in the console log in QA format.
// USAGE: After conversing with ChatGPT, run this code on the Chrome developer console.
const textList = []
document.querySelectorAll('.text-base').forEach((t, i) => {
textList.push(`${i % 2 === 0 ? "Q:" : "A:"} ${t.textContent}`)
})
console.log(textList.join('\n'));
@shinshin86
shinshin86 / make_gif.py
Last active June 1, 2022 21:20
Python script to join images together to create a GIF.
from PIL import Image
from os import path
from glob import glob
import sys
##################
# Usage:
# python make_git.py <input_dir_name> <output_filename>
##################
@shinshin86
shinshin86 / google-chrome-profile-backup-on-macos.sh
Created December 16, 2020 01:36
Google Chrome profile backup shell script on macOS
# Google Chrome
zip -r chrome-profile-bk ~/Library/Application\ Support/Google/Chrome
# Google Chrome Canary
zip -r chrome-canary-profile-bk ~/Library/Application\ Support/Google/Chrome\ Canary
@shinshin86
shinshin86 / look-back-at-the-GitHub-repository-I-created.sh
Created October 30, 2020 23:46
[Shell scripts for my own use] A command to run to look back at the GitHub repository I created.
curl https://api.github.com/users/shinshin86/repos?sort=created | jq -r '.[] | { full_name: .full_name, created_at: .created_at, url: .html_url}'
@shinshin86
shinshin86 / nextjs-google-analytics-setup-example-with-typescript.tsx
Last active December 4, 2022 00:05
Google analytics setup example at Next.js with TypeScript
// pages/_document.tsx
// And setup to next.config.js ↓↓↓
/*
module.exports = {
publicRuntimeConfig: {
TRACKING_ID: process.env.TRACKING_ID || '',
},
serverRuntimeConfig: {
TRACKING_ID: process.env.TRACKING_ID || '',
},