Last active: 2 years ago
SSH config
ProxyCommand connect -S 127.0.0.1:10808 -a none %h %p
Host github.com
User git
Port 22
Hostname github.com
# 注意修改路径为你的路径
IdentityFile "C:\Users\xfy\.ssh\id_rsa"
TCPKeepAlive yes
Host ssh.github.com
User git
Port 443
Hostname ssh.github.com
# 注意修改路径为你的路径
IdentityFile "C:\Users\xfy\.ssh\id_rsa"
TCPKeepAlive yes
Last active: a year ago
useTextScroll.ts
import { nanoid } from 'nanoid';
import { useEffect } from 'react';
import styles from './useTextScroll.module.less';
const addTransformFrames = (
name: string,
transformX: number,
styleElement: HTMLStyleElement
) => {
// styleElement.type = 'text/css';
const keyFrames = `
@-webkit-keyframes ${name} {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(${transformX}px);
}
}
@-moz-keyframes ${name} {
Last active: 2 years ago
fn main() {
println!("fibonaaci: {}", fibonaaci(8))
}
fn fibonaaci(n: u128) -> u128 {
let (mut a, mut b) = (0, 1);
(1..n).for_each(|_x| (a, b) = (b, a + b));
a
}
Last active: 2 years ago
fn plus_one(target: Option<i32>) -> Option<i32> {
target.map(|x| x + 1);
target
}
fn main() {
let my_num = Some(41);
let my_num = plus_one(my_num);
println!("My number: {:?}", my_num);
}
Last active: 2 years ago
#[derive(Debug)]
enum IpAddKind {
V4,
V6,
}
#[derive(Debug)]
struct IpAddr {
kind: IpAddKind,
address: String,
}
impl IpAddr {
fn new(kind: IpAddKind, address: String) -> Self {
Self { kind, address }
}
}
fn main() {
let eno1 = IpAddr::new(IpAddKind::V4, String::from("192.168.0.250"));
Last active: 2 years ago
#[derive(Debug)]
enum IpAddKind {
V4(u8, u8, u8, u8),
V6(String),
}
fn main() {
let eno1 = IpAddKind::V4(192, 168, 0, 250);
let loopback = IpAddKind::V6(String::from("::1"));
}
Last active: 2 years ago
enum Message {
Quite,
Move { x: i32, y: i32 },
Write(String),
ChangeColor(i32, i32, i32),
}
impl Message {
fn call(&self) {}
}
fn main() {
let m = Message::Write(String::from("xfy"));
m.call();
}
Last active: 2 years ago
#[derive(Debug)]
struct Ractangle {
widht: u32,
height: u32,
}
impl Ractangle {
fn new(widht: u32, height: u32) -> Self {
Self { widht, height }
}
fn can_hold(&self, target: &Ractangle) -> bool {
self.widht > target.widht && self.height > target.height
}
}
fn main() {
let my_ract = Ractangle::new(42, 42);
println!("My ract: {:?}", my_ract);
Last active: 2 years ago
import { isMobile } from '@/data';
import openIcon from '@/projects/viewer/assets/images/navi-page/打开.png';
import closeIcon from '@/projects/viewer/assets/images/navi-page/收起.png';
import { useBoolean } from 'ahooks';
import { nanoid } from 'nanoid';
import { useCallback, useEffect, useMemo } from 'react';
import styled, { css } from 'styled-components';
const IntelligenceQA = () => {
// 控制 iframe opacity
const [showIframe, setShowIframe] = useBoolean(false);
// 控制 iframe display
const [display, setDisplay] = useBoolean(false);
const handleClose = () => {
if (showIframe) {
setShowIframe.toggle();
setTimeout(setDisplay.toggle, 300);
} else {
setDisplay.toggle();
// 在下个任务队列中设置 opacity 才能配合 display none 显示动画
Last active: 2 years ago
export const Wrapper = styled.div`
position: fixed;
bottom: 0.4rem;
right: 0.4rem;
`;
export const Icon = styled.div<{ show: boolean }>`
cursor: pointer;
border-radius: 1rem;
overflow: hidden;
height: 0.52rem;
position: relative;
width: 2.08rem;
transition: all 0.3s ease;
${({ show }) =>
css`
max-width: ${!show ? '2.08rem' : '0.5rem'};
`}
`;
Last active: 2 years ago
fn main() {
let nums = vec![1, 7, 24, 457, 435, 23, 55, 132, 66, 256, 0, 88, 5];
println!("Original vec: {:?}", nums);
println!("{:?}", find_mid_element(nums))
}
fn find_mid_element(v: Vec<i64>) -> String {
let mut sorted_nums = v;
sorted_nums.sort();
let mid_index = sorted_nums.len() / 2;
let mid = sorted_nums.get(mid_index).expect("cannot index");
format!("Vec: {:?}, mid element: {}", sorted_nums, mid)
}
Last active: 2 years ago
Remove package
pacman -Q | cut -f 1 -d " " | grep budgie | yay -Rns -