Skip to content

Instantly share code, notes, and snippets.

View zmaplex's full-sized avatar
🏠
Working from home

zmaplex zmaplex

🏠
Working from home
View GitHub Profile
import { useState } from 'react';
import useSWR from 'swr';
const fetchMoreData = async (count: number) => {
await new Promise((resolve) => setTimeout(resolve, count * 100));
return count
}
export default function Demo() {
const [count, setCount] = useState(0);
@zmaplex
zmaplex / test.py
Last active August 31, 2022 12:58
test.py
class CustomList(list):
def __getattribute__(self, item):
methods = ['append', 'clear', 'copy', 'extend', 'insert', 'pop', 'remove']
if item not in methods:
return super(CustomList, self).__getattribute__(item)
method = super(CustomList, self).__getattribute__(item)
def length_change(*args, **kwargs):
data = method(*args, **kwargs)
测试COS域名
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10 100 10 0 0 84 0 --:--:-- --:--:-- --:--:-- 85
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 10
Connection: keep-alive
Accept-Ranges: bytes
Cache-Control: public
@zmaplex
zmaplex / crontab.py
Last active January 28, 2022 08:45
A tool class to modify the system crontab, support adding (if it already exists, it will not be added repeatedly) and delete
import os
import sys
import time
class CronTab:
def __init__(self) -> None:
self.crontab_file = '/tmp/{}.crontab'.format(time.time())
self.__init__crontab()
#!/bin/bash
# The files installed by the script conform to the Filesystem Hierarchy Standard:
# https://wiki.linuxfoundation.org/lsb/fhs
# The URL of the script project is:
# https://github.com/v2fly/fhs-install-v2ray
# The URL of the script is:
# https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh
vmess1://bc1a1d68-a317-478f-a14e-73f54d1ab143@dl.google.com:448?network=tcp&tls=true&tls.servername=dl.google.com&tls.allowinsecure=true#jp1
vmess1://bc1a1d68-a317-478f-a14e-73f54d1ab143@dl.google.com:448?network=tcp&tls=true&tls.servername=dl.google.com&tls.allowinsecure=true#jp2
systemctl stop v2ray
systemctl disable v2ray
service v2ray stop
update-rc.d -f v2ray remove
rm -rf /etc/v2ray/*
rm -rf /usr/bin/v2ray/*
rm -rf /var/log/v2ray/*
rm -rf /lib/systemd/system/v2ray.service
rm -rf /etc/init.d/v2ray
@zmaplex
zmaplex / 201920.py
Created December 19, 2019 18:49
201920.py
import json
import os
dataFile = "data.json"
jsonData = {}
def init():
if not os.path.isfile(dataFile):
saveData()
@zmaplex
zmaplex / Question3.py
Created December 19, 2019 18:09
Question3.py
import random
states = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
'AS': 'American Samoa',
'AZ': 'Arizona',
'CA': 'California',
'CO': 'Colorado',
@zmaplex
zmaplex / Question1.py
Created December 19, 2019 18:00
Question1.py
population = [34372, 37821, 45673, 67100, 69100, 70245]
year = ['2012', '2013', '2014', '2015', '2016', '2017']
def getGreatestYear():
maxPopulation = max(population)
index = population.index(maxPopulation)
return year[index]