Skip to content

Instantly share code, notes, and snippets.

View FlowerWrong's full-sized avatar
💭
I may be slow to respond.

浮生 FlowerWrong

💭
I may be slow to respond.
View GitHub Profile
@FlowerWrong
FlowerWrong / claude_code.md
Last active January 16, 2026 03:25
claude code in action

Get Start

Unix 哲学:Claude Code 是可组合和可脚本化的。tail -f app.log | claude -p "Slack me if you see any anomalies appear in this log stream" 有效。您的 CI 可以运行 claude -p "If there are new text strings, translate them into French and raise a PR for @lang-fr-team to review"。

/resume 继续之前的对话

/init 初始化已有项目CLAUDE.md

claude --continue 继续当前目录中最近的对话 claude --resume 打开对话选择器或按名称恢复

require 'open-uri'
url = 'https://gist.githubusercontent.com/FlowerWrong/bccee4d63a6f0542523074f2ae184094/raw/131d8508d12f5a995524d07a3c45aa21495afd21/smart-config.txt'
open(url).each_line do |row|
arr = row.split(' ')
if arr[0] == 'direct_domain'
arr.each_with_index do |domain, i|
if i == 0
next
end
@FlowerWrong
FlowerWrong / binance_vetusdt.lua
Created May 7, 2021 02:10
binance vet price for hammerspoon
local binanceVETMenubar = hs.menubar.new()
BINANCE_URL = 'https://fapi.binance.com'
SYMBOL = 'VETUSDT'
local url = BINANCE_URL .. "/fapi/v1/ticker/price?symbol=" .. SYMBOL
local vetPrices = {}
--------------------------------------------------------------------------------
-- splicing: remove elements from a table
@FlowerWrong
FlowerWrong / AAPL.py
Created February 6, 2021 14:24
AAPL stock line chart in python using charthub.cc
# demo code
import plotly.express as px
import plotly.io as pio
import akshare as ak
pio.templates.default = "none"
df = ak.stock_us_daily(symbol='AAPL', adjust='qfq')
df = df.loc['2015-01-01':'2022-01-01']
df = df.reset_index()
@FlowerWrong
FlowerWrong / 10m_china_subunits.geo.json
Created December 14, 2020 05:58
10m_china_subunits.geo.json
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@FlowerWrong
FlowerWrong / 10m_china_countries.geo.json
Created December 14, 2020 05:57
10m_china_countries.geo.json
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@FlowerWrong
FlowerWrong / top10_mem.sh
Created September 24, 2020 09:55
Display Processes Sorted By Memory Usage in Linux
ps axo rss,comm,pid \
| awk '{ proc_list[$2] += $1; } END \
{ for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc],proc); }}' \
| sort -n | tail -n 10 | sort -rn \
| awk '{$1/=1024;printf "%.0fMB\t",$1}{print $2}'
@FlowerWrong
FlowerWrong / sentry.sh
Created September 14, 2020 08:01
sentry
// https://develop.sentry.dev/self-hosted/
// https://github.com/getsentry/onpremise
git clone git@github.com:getsentry/onpremise.git
cd onpremise
./install.sh
docker-compose up -d
@FlowerWrong
FlowerWrong / application.js
Created September 12, 2020 06:12
rails 6 webpacker gridstack.js
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
import $ from "jquery" // yarn add jquery
// yarn add gridstack
import "gridstack/dist/jq/jquery-ui"
import 'gridstack/dist/gridstack-poly'; // optional IE support
@FlowerWrong
FlowerWrong / china_region.rb
Created August 20, 2020 09:22
China region
# rails g model ChinaRegion name parent_id lng lat
class AddChinaRegionData < ActiveRecord::Migration[6.0]
def up
# https://github.com/pfinal/city
ChinaRegion.destroy_all
ActiveRecord::Base.connection.reset_pk_sequence!(ChinaRegion.table_name)
data = []
File.open(Rails.root.join('db', 'data', 'region.txt')).each do |line|
next unless /\((.*)\).*/ =~ line