Skip to content

Instantly share code, notes, and snippets.

@milk1000cc
milk1000cc / claude_test.rb
Created April 13, 2024 02:47
Claude-3 Haiku + Ruby
# Thanks to: https://zenn.dev/minedia/articles/c018dd09801091
ANTHROPIC_API_KEY = ''
SYSTEM_PROMPT = <<~EOS
あなたはECサイトを運営していて商品にとても詳しい人物です。
このタスクでは、商品名から不要なワードを除去する必要があります。
不要なワードとは、プロモーションに関連する言葉や、商品名には不適切な追加情報 (例:「送料無料」、「特価」、【中古】、【ポイント10倍】など) を指します。
タスク:
@milk1000cc
milk1000cc / traefik_no_404.yml
Created March 31, 2023 10:22
mrsk v0.10.1 + traefik XXX Instead of 404
# config/deploy.yml
traefik:
options:
label:
# https://doc.traefik.io/traefik/getting-started/faq/#xxx-instead-of-404
# https://community.traefik.io/t/catchall-router-that-returns-503-service-unavailable-response-code/10651
- traefik.http.routers.catchall.rule=PathPrefix(`/`)
- traefik.http.routers.catchall.service=unavailable
- traefik.http.routers.catchall.priority=1
@milk1000cc
milk1000cc / fly.toml
Last active March 7, 2023 12:27
Squid on fly.io
# SEE ALSO: https://github.com/BynariStar/heroku-squid-proxy
app = "my-squid"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
[experimental]
@milk1000cc
milk1000cc / postcss.config.js
Created January 8, 2023 06:01
SugarSS as an alternative to Sass
module.exports = {
parser: require('sugarss'), // https://github.com/postcss/sugarss
plugins: [
require('postcss-import-ext-glob'),
require('postcss-import'),
require('postcss-mixins'),
require('postcss-simple-vars'),
require('postcss-nested'),
require('autoprefixer'),
@milk1000cc
milk1000cc / vessel.rb
Last active March 5, 2023 07:57
use vessel as an alternative to kimurai: https://github.com/rubycdp/vessel
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'vessel', github: 'rubycdp/vessel' # commit 3097da3daeb2b0f06182b2d4faa7693d82407538
end
class FirstMiddleware < Vessel::Middleware
def call(item, _)
item[:h1] += '!'
まつげパーマ,4786,4786,5000,まつげパーマ,名詞,固有名詞,一般,*,*,*,マツゲパーマ,まつげパーマ,*,C,149959/237044,*,*
まつ毛パーマ,4786,4786,5000,まつ毛パーマ,名詞,固有名詞,一般,*,*,*,マツゲパーマ,まつげパーマ,*,C,150174/237044,*,*
まつパ,4786,4786,5000,まつパ,名詞,固有名詞,一般,*,*,*,マツパ,まつげパーマ,*,*,*,*,*
マツパ,4786,4786,5000,マツパ,名詞,固有名詞,一般,*,*,*,マツパ,まつげパーマ,*,*,*,*,*
まつぱ,4786,4786,5000,まつぱ,名詞,固有名詞,一般,*,*,*,マツパ,まつげパーマ,*,*,*,*,*
まつ毛エクステ,4786,4786,5000,まつ毛エクステ,名詞,固有名詞,一般,*,*,*,マツゲエクステ,まつげエクステ,*,C,150174/183510,*,*
まつエク,4786,4786,5000,まつエク,名詞,固有名詞,一般,*,*,*,マツエク,まつげエクステ,*,*,*,*,*
マツエク,4786,4786,5000,マツエク,名詞,固有名詞,一般,*,*,*,マツエク,まつげエクステ,*,*,*,*,*
@milk1000cc
milk1000cc / bybit.rb
Created May 7, 2021 13:22
Ruby Bybit API Example
# https://bybit-exchange.github.io/docs/inverse/
# https://github.com/bybit-exchange/api-connectors/blob/master/encryption_example/Encryption.rb
require 'open-uri'
require 'openssl'
require 'json'
require 'bigdecimal'
require 'bigdecimal/util'
API_ENDPOINT = 'https://api.bybit.com'
@milk1000cc
milk1000cc / my_axios.js
Created January 26, 2019 05:59
axios + rails csrf token + common error handling
import axios from 'axios'
import { csrfToken } from 'rails-ujs'
const myAxios = axios.create()
myAxios.defaults.headers.common['X-CSRF-Token'] = csrfToken()
myAxios.interceptors.response.use(res => res, error => {
const msg = "エラーが発生しました。\n\nしばらく時間をおいてから、もう一度お試しください。\n" +
"ご不便をおかけしてしまい、大変申し訳ございません。"
@milk1000cc
milk1000cc / bugsnag.rb
Created October 9, 2016 02:34
Bugsnag + Rails example
Bugsnag.configure do |config|
config.api_key = ENV['BUGSNAG_API_KEY']
if Rails.env.development? || Rails.env.test?
config.auto_notify = false
end
config.ignore_classes = [] if config.app_type == 'sidekiq'
end
@milk1000cc
milk1000cc / wercker.yml
Last active August 29, 2015 14:19
Use ruby 2.2.2 on wercker now
box: wercker/rvm
build:
steps:
- script:
name: install ruby
code: |
rvm get latest
rvm reload
rvm install ruby-2.2.2