This file contains 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
function chan<T>() { | |
let p = Promise.withResolvers<T>(); | |
async function* gen() { | |
while (true) { | |
let v; | |
try { | |
v = await p.promise; | |
} catch { | |
return; |
This file contains 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
sudo yum update -y | |
sudo yum install -y squid | |
sudo cat <<EOL > /etc/squid/squid.conf | |
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd | |
auth_param basic realm proxy | |
auth_param basic children 5 | |
acl HTTP_ports port 443 | |
acl HTTP_ports port 80 |
This file contains 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 * as toml from 'https://deno.land/[email protected]/toml/mod.ts'; | |
async function getStripeConfig() { | |
const { stdout } = await new Deno.Command('stripe', { | |
args: ['config', '--list'], | |
stderr: 'inherit', | |
}).output(); | |
return toml.parse(new TextDecoder().decode(stdout)) as any; | |
} |
This file contains 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
function memoize<Args extends unknown[], R>(f: (...args: Args) => R): (...args: Args) => R { | |
const cache = new Map(); | |
let retCache: { value: R } | undefined; | |
return (...args: Args): R => { | |
if (args.length > 0) { | |
if (!cache.has(args[0])) { | |
cache.set(args[0], memoize((...restArgs) => (f as any)(args[0], ...restArgs))); | |
} | |
return cache.get(args[0])(...args.slice(1)); | |
} |
This file contains 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 graphql from 'graphql'; | |
const resp = await fetch(url, { method: 'POST', body: JSON.stringify({ query: graphql.getIntrospectionQuery() }), headers: { 'content-type': 'application/json' } }); | |
const introspectionResult = await resp.json(); | |
const schema = graphql.buildClientSchema(introspectionResult.data); | |
const sdl = graphql.printSchema(schema); |
This file contains 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 { list } from '@keystone-6/core'; | |
import { graphql } from '@keystone-6/core'; | |
import { allowAll } from '@keystone-6/core/access'; | |
import { checkbox, relationship, text, timestamp } from '@keystone-6/core/fields'; | |
import { select } from '@keystone-6/core/fields'; | |
import { BaseListTypeInfo, CommonFieldConfig, FieldTypeFunc, fieldType } from '@keystone-6/core/types'; | |
interface TranslatedFieldConfig< | |
ListTypeInfo extends BaseListTypeInfo, | |
LanguageTag extends string, |
This file contains 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
const fetch = require('node-fetch'); | |
const util = require('util'); | |
util.inspect.defaultOptions.depth = null; | |
console.log = (...args) => { | |
return fetch('https://webhook.site/XXXXX', { | |
method: 'POST', | |
body: util.format(...args), | |
}); | |
}; |
This file contains 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 { mapSchema, getDirective, MapperKind } from '@graphql-tools/utils'; | |
import { defaultFieldResolver, GraphQLError, GraphQLFieldResolver, GraphQLSchema } from 'graphql'; | |
function wrapField<Field extends { resolve?: GraphQLFieldResolver<any, any> }>(field: Field, authDirective: Record<string, any>) { | |
const { resolve = defaultFieldResolver } = field; | |
field.resolve = (src, args, ctx, info) => { | |
if (ctx.role !== authDirective.role) throw new GraphQLError(`${authDirective.role} role is needed but your role is ${ctx.role}.`); | |
return resolve(src, args, ctx, info); | |
}; |
This file contains 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
echo abc | openssl rsautl -encrypt -pubin -inkey <(ssh-keygen -f <(curl https://github.com/acomagu.keys) -e -m PKCS8) | openssl rsautl -decrypt -inkey ~/.ssh/id_rsa |
This file contains 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
<!DOCTYPE html> | |
<body> | |
<form method="POST" action="https://raraya:Qm3VMV7pgnAgNch2WzqWYN5kDVNLGmiNCk6nihwc8U4KwEKSmd@shop-stage.raraya.co.jp/external/ordermadeparts.php"> | |
<input type="hidden" name="apiKey" value="ZWJcQYnhM9YNS4OiVcphyDmEtNGr8rKv4qgEUKdDxGZ1WEzBnc" /> | |
<input type="hidden" name="a" value="1" /> | |
<input type="hidden" name="b" value="1" /> | |
<input type="hidden" name="c" value="1" /> | |
<input type="hidden" name="d" value="1" /> | |
<input type="hidden" name="e" value="1" /> | |
<input type="hidden" name="f" value="1" /> |
NewerOlder