Skip to content

Instantly share code, notes, and snippets.

View potato4d's full-sized avatar
💭
It's not so easy to be consistent

Takuma HANATANI potato4d

💭
It's not so easy to be consistent
View GitHub Profile
const fs = require('fs/promises')
async function run() {
const rule = 'oretachi'
const file = await fs.readFile(`${__dirname}/../lflist.conf`, { encoding: 'utf-8' })
const oretachi = file.split(`!${rule}`)[1].split("\n!")[0]
const [_, ...texts] = oretachi.split('#')
console.log(texts)
const forbidden = texts[0].split('\n').filter((_,n) => n).filter((c) => c).map((content) => content.split('--')[1])
const limited = texts[1].split('\n').filter((_,n) => n).filter((c) => c).map((content) => content.split('--')[1])
const axios = require('axios')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customHolidays = require('./custom_holidays')
dayjs.extend(utc)
dayjs.extend(timezone)
async function run() {
import express from 'express'
const app = express()
const PORT = ~~(process.env.PORT || 3000)
app.get('/users/stat', (req, res) => {
res.json({
path: '/users/stat',
})
})
@potato4d
potato4d / package.json
Last active February 19, 2021 15:27
rehype プラグインとして動く img に width / height を付与するやつ (パッケージ化するかは不明)
{
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/hast": "^2.3.1",
"@types/jimp": "^0.2.28",
"hast": "^1.0.0",
"rehype": "^11.0.0",
"typescript": "^4.0.2"
},
"dependencies": {
@potato4d
potato4d / app.html
Created November 6, 2020 03:17
Nuxt.js use enviroment variables in app.html file
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ ENV.GA_ID }}"></script>
<script>
console.log(`GA_ID: {{ ENV.GA_ID }}`)
</script>
<head>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
@potato4d
potato4d / cleaner.js
Last active December 24, 2023 14:32
The Google App script for clean up your Gmail Inbox
/**
* Gmail Cleaner v0.1.0
* publishedAt: 2020/10/25
* Author: @potato4d
* LICENSE: MIT
**/
// TODO: Customize
const target = [
'[email protected]',
#include <SwitchControlLibrary.h>
void setup(){
// put your setup code here, to run once:
SwitchControlLibrary().PressButtonR();
delay(50);
SwitchControlLibrary().ReleaseButtonR();
delay(500);
SwitchControlLibrary().PressButtonL();
delay(50);
import admin from 'firebase-admin'
const credential: any = null // 書き換えてね
const app = admin.initializeApp({
credential: admin.credential.cert(credential),
})
const splitByCount = (n: number, arr: admin.auth.UserRecord[]) => {
return arr.reduce((before: admin.auth.UserRecord[][], now: admin.auth.UserRecord) => {
import 'vue-tsx-support'
import { AllHTMLAttributes } from "vue-tsx-support/types/dom";
declare module "vue-tsx-support/types/base" {
type HTMLAttrs = Omit<AllHTMLAttributes, 'size'>
interface ComponentAdditionalAttrs extends HTMLAttrs {}
}
declare module 'vue-feather-icons' {
import Vue from 'vue'
type FeatherIconProps = {
size: string
}
type FeatherIconComponent = import('vue/types/vue').ExtendedVue<
Vue,
{},
{},
{},