Skip to content

Instantly share code, notes, and snippets.

View cbdyzj's full-sized avatar
🐱

阿尔贝鲁 cbdyzj

🐱
View GitHub Profile
@cbdyzj
cbdyzj / proxy_for_git.sh
Created January 26, 2024 14:48
Set proxy for Git
# Method 1. git http + proxy http
git config --global http.proxy "http://127.0.0.1:1080"
git config --global https.proxy "http://127.0.0.1:1080"
# Method 2. git http + proxy shocks
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"
# to unset
git config --global --unset http.proxy
@cbdyzj
cbdyzj / open_google_chrome_disable_web_security.sh
Created May 6, 2023 13:43
open Google Chrome disable web security
open -n -a 'Google Chrome' 'https://github.com/' --args --user-data-dir='/tmp/chrome_dev_0' --disable-web-security --allow-running-insecure-content
@cbdyzj
cbdyzj / NameHash.jsx
Created April 10, 2022 01:28
NameHash.jsx
import React, { useState } from 'react'
import styled from '@emotion/styled'
import murmur3 from '../../utils/murmurhash3_32.js'
const Container = styled.div`
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
height: 75vh;
@cbdyzj
cbdyzj / XNano.jsx
Created April 10, 2022 01:15
XNano.jsx
import React, { Component, useRef } from 'react'
import styled from '@emotion/styled'
import { sleep } from '../../utils/schedule.js'
const Container = styled.div`
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
@cbdyzj
cbdyzj / Counter.jsx
Created April 10, 2022 01:13
Counter.jsx
import React, { useReducer } from 'react'
import styled from '@emotion/styled'
import { sleep } from '../../utils/schedule.js'
const initialState = { count: 7n }
function reducer(state = initialState, action) {
if (action.type === 'setCount') {
return {
...state,
@cbdyzj
cbdyzj / PriceInput.vue
Last active April 9, 2022 12:27
PriceInput.vue
<template>
<input type="text"
inputmode="numeric"
:value="editing ? value : formattedValue"
@focus="editing = true"
@blur="editing = false"
@input="value = $event.target.value"
placeholder="Enter"
pattern="[0-9]*"/>
</template>
@cbdyzj
cbdyzj / backup_github.js
Last active February 28, 2022 11:53
Backup GitHub Public Repositories
async function getRepositoryCloneListByPage(name, page = 1) {
const response = await fetch(`https://api.github.com/users/${name}/repos?page=${page}`)
const result = await response.json()
return result.map((it) => {
return it.clone_url
})
}
async function getRepositoryCloneList(name) {
let page = 1
const classNameSet = new Set()
function getRandomClassName() {
const className = Math.random().toString(36).substring(2)
if (classNameSet.has(className)) {
return getRandomClassName()
}
classNameSet.add(className)
return `css-${className}`
}
@cbdyzj
cbdyzj / java_bio.java
Last active August 27, 2021 14:18
java_bio
var handler = (Consumer<byte[]>) (bytes) -> {
CompletableFuture.runAsync(() -> {
var readStr = new String(bytes);
System.out.println("readStr: " + readStr);
});
};
var inputStream = System.in;
var readThread = new Thread(() -> {
try {
@cbdyzj
cbdyzj / excel.js
Created March 2, 2021 13:22
JavaScript Excel
import xlsx from 'xlsx'
export function importExcelFile(file) {
return new Promise((resolve, reject) => {
function handleOnLoad(event) {
try {
const { result } = event.target;
const workbook = xlsx.read(result, { type: 'binary' });
const sheetsData = [];
for (const sheet of Object.entries(workbook.Sheets)) {