Skip to content

Instantly share code, notes, and snippets.

@shiny
shiny / domain-connect.adoc
Created March 24, 2025 06:04
Domain connect chinese translation
:toc: macro
:toc-title: 目录
:toclevels: 4
:source-highlighter: prettify
:sectnums:
:specversion: 2.3
:revnumber: 67
:revdate: 3-02-2025
:revremark: 草案
:apply-image-size:
@shiny
shiny / docker-compose.yml
Created January 16, 2025 12:09
postgres docker-compose example
services:
db:
image: postgres:17.2
command:
- postgres
- -c
- config_file=/etc/postgresql/postgresql.conf
environment:
POSTGRES_USER: u301
POSTGRES_DB: u301
@shiny
shiny / Netcup Gutschein.md
Created November 11, 2024 10:44
Netcup Gutschein
@shiny
shiny / shadcn.json
Last active November 6, 2024 14:10
test shadcn component
{
"name": "button",
"type": "registry:ui",
"dependencies": [
"@radix-ui/react-slot"
],
"files": [
{
"path": "ui/button.tsx",
"content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-ac
@shiny
shiny / 多维数组.php
Last active April 28, 2019 06:36
多维数组.php
<?php
$a = [ 'Date','Media','Geo' ];
$b = [ 'Num' ];
$subject = [ 'Date'=>'2019-04-26','Media'=>'AAA','Geo'=>'CN','Num'=>105 ];
// 多维数组的最后一项
$value = array_intersect_key($subject, array_fill_keys($b, 1));
// 生成多维数组
$res = createMultiArray($a, $value, $subject);
var_dump([
@shiny
shiny / 杭州机动车驾驶人理论培训平台——模拟练习页面体验改进.md
Last active April 5, 2019 09:19
杭州机动车驾驶人理论培训平台——模拟练习页面体验改进

为什么要用这个平台刷题

因为和真实题库一致,而手机 App 上的题库和实际题库有差别。

当前平台的缺点:

  1. 点击答案无法选中,必须要精确点击 radio 按钮才选中答案,点击右下角的 ABCD 选项又不直观
  2. 回答完成切入下一题过于麻烦

改进:

  1. 点击答案文字就能选中;
@shiny
shiny / get-ssl-inform.php
Created July 23, 2017 10:26
get-ssl-inform.php
<?php
$g = stream_context_create ([
"ssl" => ["capture_peer_cert" => true],
'http' => [
'method' => 'GET',
'user_agent' => 'shouwang.io ssl detector',
'timeout'=>10
]
]);
$r = fopen("https://www.baidu.com/", "rb", false, $g);
@shiny
shiny / page.php
Created February 28, 2017 09:33
page.php
<?php
class Page
{
public static function Generate($page, $count, $perpage=50)
{
$max = ceil($count / $perpage);
if($page > $max) {
$page = $max;
} else if($page < 1) {
$page = 1;
package main
import "fmt"
import "strings"
import "math"
func main() {
fmt.Println(get_num("r9"))
fmt.Println(generate_code(840))
}
@shiny
shiny / monty-hall-problem.php
Last active November 26, 2016 11:54
三门问题 PHP 模拟代码
<?php
define('GOAT', 0);
define('CAR', 1);
echo "尝试五次,每次1000遍,换门的中奖率\n";
for($j=0;$j<5;$j++) {
$exchange = true;
simulation($exchange);
}