python3.8 -m venv esrgan
cd esrgan
source bin/activate.fish
pip install torch torchvision
python -m pip install --upgrade pip setuptools
pip install realesrgan
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 React from 'react' | |
import { csrfToken } from '@rails/ujs' | |
export const AuthenticityToken = (): React.ReactElement => | |
<input type="hidden" name="authenticity_token" value={csrfToken() ?? ''} /> |
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
@doc """ | |
テーブルをロックしコードを実行する | |
### Example | |
``` | |
iex> MyProject.Repo.lock_tables fn -> IO.puts "hello" end, users: :read | |
``` | |
""" | |
@spec lock_tables(fun, keyword(atom)) :: no_return |
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 Bitwise | |
@doc """ | |
与えられた数値の指定されたビットの値を読み出す | |
### Example | |
``` | |
iex> bit_at(42, 3) | |
true |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem 'activesupport' |
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
class Main | |
require 'aws-sdk-appconfigdata' | |
def initialize(application:, environment:, profile:) | |
@application = application | |
@environment = environment | |
@profile = profile | |
@client = Aws::AppConfigData::Client.new( | |
region: 'ap-northeast-1', |
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
#!/bin/sh | |
PROJECT="rails8" | |
set -e | |
rm -rf .bundle .devcontainer .gitignore .github .kamal .rubocop.yml Gemfile* README.md Rakefile app bin compose.yml config* db lib log public script storage test tmp *.js* *.dev *.lock | |
rm -rf .dockerignore .gitattributes .node-version .tool-versions Dockerfile | |
rm -rf .git | |
rm -f Gemfile* |
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
#!/usr/bin/env ruby | |
# | |
# you need add 'full disk access' privilege to /opt/homebrew/opt/mackerel-agent/bin/mackerel-agent. | |
class Main | |
require 'timeout' | |
CRITERIA = 3 | |
def run |
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
query = 'select AES_DECRYPT(FROM_BASE64(:encrypted), :key) as plain' | |
sql = ActiveRecord::Base.sanitize_sql_array([ | |
query, encrypted: '+mACVel1fgUZIc2Dd+CiFw==', key: 'secret' | |
]) | |
if (result = ActiveRecord::Base.connection.select_all(sql)).present? | |
result.to_a.first.dig('plain') | |
end |
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
// see also: https://barker.codes/blog/serialize-form-data-into-an-array-in-vanilla-js/ | |
// NOTE: type FormDataEntryValue = File | string | |
type SerializeArray = { [x: string]: FormDataEntryValue } | |
const serializeArray = (form: HTMLFormElement): SerializeArray => { | |
const result: SerializeArray = <SerializeArray>{} | |
const formData: FormData = new FormData(form) |