smolapp 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/aaa.js ADDED
@@ -0,0 +1,93 @@
1
+ const { exec } = require('child_process');
2
+ const fs = require('fs').promises;
3
+ const path = require('path');
4
+
5
+ // 生成所有小写字母(a-z)
6
+ const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(97 + i));
7
+ const numbers = Array.from({ length: 10 }, (_, i) => i.toString());
8
+ // const str = `drum, sack, pail, tub`
9
+ // 生成前两位随机字母、最后一位固定为 'c' 的三位数字母组合(格式:xxc)
10
+ const generateCombinations = () => {
11
+ let combinations = [];
12
+ // 第一位和第二位遍历所有字母,第三位固定为 'c'
13
+ for (const first of letters) {
14
+ for (const second of letters) {
15
+ // combinations.push(`${first}${second}`);
16
+ combinations.push(`f${second}${first}`);
17
+ }
18
+ }
19
+ // combinations = str.split(', ')
20
+
21
+ return combinations;
22
+ };
23
+
24
+ // 调用 npm view 检查包名是否存在
25
+ const checkPackageExists = (packageName) => {
26
+ return new Promise((resolve) => {
27
+ // 执行 npm view 命令,超时时间5秒
28
+ exec(`npm view ${packageName} --silent`, { timeout: 5000 }, (error) => {
29
+ // 命令出错(如 404)视为未注册
30
+ resolve({ packageName, exists: !error });
31
+ });
32
+ });
33
+ };
34
+
35
+ // 批量检查包名(控制并发数)
36
+ const batchCheckPackages = async (combinations, concurrency = 10) => {
37
+ const results = [];
38
+ const total = combinations.length;
39
+ let checked = 0;
40
+
41
+ console.log(`开始检查 ${total} 个包名...\n`);
42
+
43
+ // 分批次并行检查
44
+ for (let i = 0; i < total; i += concurrency) {
45
+ const batch = combinations.slice(i, i + concurrency);
46
+ const batchResults = await Promise.all(batch.map(pkg => checkPackageExists(pkg)));
47
+ results.push(...batchResults);
48
+ // 更新进度
49
+ checked += batch.length;
50
+ console.log(`已检查 ${checked}/${total} 个包名(未注册:${results.filter(r => !r.exists).length})`);
51
+ }
52
+
53
+ return results;
54
+ };
55
+
56
+ // 主函数:生成组合 → 检查 → 输出未注册包名
57
+ const main = async () => {
58
+ try {
59
+ const combinations = generateCombinations();
60
+ console.log(`已生成 ${combinations.length} 个 "前两位字母+固定c" 的三位组合(如 aac、abc...)\n`);
61
+
62
+ const results = await batchCheckPackages(combinations);
63
+
64
+ // 筛选未注册的包名
65
+ const availablePackages = results
66
+ .filter(item => !item.exists)
67
+ .map(item => item.packageName);
68
+
69
+ // 输出结果
70
+ console.log('\n===== 检查完成 =====');
71
+ console.log(`总组合数:${combinations.length}`);
72
+ console.log(`已注册包名:${results.filter(r => r.exists).length}`);
73
+ console.log(`未注册包名:${availablePackages.length}\n`);
74
+
75
+ console.log('具体未注册的包名列表:');
76
+ availablePackages.forEach((pkg, index) => {
77
+ // 每行打印10个,方便查看
78
+ process.stdout.write(`${pkg} `);
79
+ if ((index + 1) % 10 === 0) process.stdout.write('\n');
80
+ });
81
+
82
+ // 保存到文件
83
+ const outputPath = path.join(__dirname, 'available-xxc-packages.txt');
84
+ await fs.writeFile(outputPath, availablePackages.join('\n'));
85
+ console.log(`\n\n未注册包名已保存到文件:${outputPath}`);
86
+
87
+ } catch (error) {
88
+ console.error('执行出错:', error);
89
+ }
90
+ };
91
+
92
+ // 启动脚本
93
+ main();
@@ -0,0 +1,207 @@
1
+ fga
2
+ fja
3
+ fla
4
+ fpa
5
+ fqa
6
+ fta
7
+ fza
8
+ fgb
9
+ flb
10
+ fqc
11
+ fjd
12
+ ftd
13
+ fzd
14
+ fbe
15
+ fje
16
+ fke
17
+ fme
18
+ fne
19
+ fqe
20
+ fte
21
+ fwe
22
+ fqf
23
+ fag
24
+ fgg
25
+ fhg
26
+ fjg
27
+ fng
28
+ fqg
29
+ frg
30
+ ftg
31
+ fxg
32
+ fzg
33
+ fbh
34
+ fdh
35
+ fkh
36
+ flh
37
+ fmh
38
+ fnh
39
+ fqh
40
+ frh
41
+ fvh
42
+ fwh
43
+ fxh
44
+ fci
45
+ fgi
46
+ fhi
47
+ fji
48
+ fki
49
+ fni
50
+ fqi
51
+ fsi
52
+ fti
53
+ fvi
54
+ fwi
55
+ fxi
56
+ fbj
57
+ fdj
58
+ fgj
59
+ fhj
60
+ fkj
61
+ fmj
62
+ fqj
63
+ frj
64
+ ftj
65
+ fvj
66
+ fwj
67
+ fxj
68
+ fck
69
+ fgk
70
+ fhk
71
+ fjk
72
+ flk
73
+ fpk
74
+ fqk
75
+ ftk
76
+ fzk
77
+ fhl
78
+ fkl
79
+ fll
80
+ fvl
81
+ fxl
82
+ fzl
83
+ fgm
84
+ fhm
85
+ fjm
86
+ fkm
87
+ flm
88
+ fqm
89
+ fwm
90
+ fxm
91
+ fdn
92
+ fgn
93
+ fhn
94
+ fjn
95
+ fln
96
+ fmn
97
+ fqn
98
+ fsn
99
+ ftn
100
+ fvn
101
+ fwn
102
+ fzn
103
+ fho
104
+ fjo
105
+ fko
106
+ fqo
107
+ fto
108
+ fvo
109
+ fwo
110
+ fxo
111
+ fhp
112
+ fkp
113
+ fqp
114
+ fvp
115
+ fwp
116
+ fzp
117
+ fcq
118
+ fgq
119
+ fjq
120
+ fmq
121
+ fpq
122
+ frq
123
+ ftq
124
+ fvq
125
+ fwq
126
+ fzq
127
+ fgr
128
+ fjr
129
+ fkr
130
+ flr
131
+ fvr
132
+ fhs
133
+ fvs
134
+ fzs
135
+ fgt
136
+ fht
137
+ fjt
138
+ fqt
139
+ fvt
140
+ fwt
141
+ fgu
142
+ fhu
143
+ fju
144
+ fku
145
+ fqu
146
+ fru
147
+ ftu
148
+ fvu
149
+ fwu
150
+ fxu
151
+ fzu
152
+ fbv
153
+ fcv
154
+ fdv
155
+ fgv
156
+ fhv
157
+ fkv
158
+ fmv
159
+ fov
160
+ fqv
161
+ frv
162
+ ftv
163
+ fxv
164
+ fyv
165
+ fzv
166
+ fcw
167
+ fgw
168
+ fhw
169
+ fjw
170
+ fkw
171
+ fmw
172
+ fnw
173
+ fpw
174
+ frw
175
+ fsw
176
+ fvw
177
+ fww
178
+ fxw
179
+ fzw
180
+ fhx
181
+ fqx
182
+ fzx
183
+ fby
184
+ fgy
185
+ fhy
186
+ fjy
187
+ fmy
188
+ fny
189
+ fpy
190
+ fqy
191
+ fty
192
+ fvy
193
+ fwy
194
+ fcz
195
+ fdz
196
+ fgz
197
+ fhz
198
+ fjz
199
+ fkz
200
+ flz
201
+ fmz
202
+ fnz
203
+ fqz
204
+ frz
205
+ ftz
206
+ fvz
207
+ fwz
package/bbb.js ADDED
@@ -0,0 +1,115 @@
1
+ // 安装依赖:npm install username-checker
2
+ const { UsernameChecker } = require('username-checker');
3
+
4
+ // 初始化检查器
5
+ const checker = new UsernameChecker();
6
+
7
+ // 生成数字 (0-9)
8
+ const numbers = Array.from({ length: 10 }, (_, i) => i.toString());
9
+ // 生成字母 (a-z)
10
+ const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(97 + i));
11
+
12
+ /**
13
+ * 生成格式为 "y+数字+字母" 的组合 (如 y0a, y3b, y9z 等)
14
+ * @returns {string[]} 所有可能的组合
15
+ */
16
+ function generateCombinations() {
17
+ const combinations = [];
18
+ // 第一位固定为 'y',第二位为数字,第三位为字母
19
+ for (const num of numbers) {
20
+ for (const letter of numbers) {
21
+ combinations.push(`y${num}${letter}`);
22
+ }
23
+ }
24
+ return combinations;
25
+ }
26
+
27
+ /**
28
+ * 检查单个GitHub用户名是否可注册
29
+ */
30
+ async function checkUsername(username) {
31
+ try {
32
+ const result = await checker.isAvailable('github', username);
33
+ return {
34
+ username,
35
+ available: result.available,
36
+ message: result.message || ''
37
+ };
38
+ } catch (error) {
39
+ return {
40
+ username,
41
+ available: null, // 检查失败
42
+ message: `错误: ${error.message}`
43
+ };
44
+ }
45
+ }
46
+
47
+ /**
48
+ * 批量检查用户名,控制并发和速率
49
+ */
50
+ async function batchCheck(usernames, concurrency = 10, delay = 20) {
51
+ const results = [];
52
+ const total = usernames.length;
53
+ let checked = 0;
54
+
55
+ console.log(`开始检查 ${total} 个 "y+数字+字母" 组合...\n`);
56
+
57
+ for (let i = 0; i < total; i += concurrency) {
58
+ const batch = usernames.slice(i, i + concurrency);
59
+ const batchResults = await Promise.all(batch.map(checkUsername));
60
+ results.push(...batchResults);
61
+
62
+ // 更新进度
63
+ checked += batch.length;
64
+ const availableCount = results.filter(r => r.available).length;
65
+ console.log(`已检查 ${checked}/${total} 个 | 可注册: ${availableCount}`);
66
+
67
+ // 批次间延迟,避免请求过于频繁
68
+ if (i + concurrency < total) {
69
+ await new Promise(resolve => setTimeout(resolve, delay));
70
+ }
71
+ }
72
+
73
+ return results;
74
+ }
75
+
76
+ /**
77
+ * 主函数
78
+ */
79
+ async function main() {
80
+ try {
81
+ const combinations = generateCombinations();
82
+ console.log(`已生成 ${combinations.length} 个组合 (格式: y+数字+字母,如 y0a, y5b)\n`);
83
+
84
+ const results = await batchCheck(combinations);
85
+
86
+ // 筛选可注册的用户名
87
+ const availableUsernames = results
88
+ .filter(item => item.available)
89
+ .map(item => item.username);
90
+
91
+ // 输出结果
92
+ console.log('\n===== 检查完成 =====');
93
+ console.log(`总检查数: ${combinations.length}`);
94
+ console.log(`可注册: ${availableUsernames.length}`);
95
+ console.log(`已占用: ${results.filter(r => r.available === false).length}`);
96
+ console.log(`检查失败: ${results.filter(r => r.available === null).length}\n`);
97
+
98
+ // 打印可注册列表
99
+ if (availableUsernames.length > 0) {
100
+ console.log('可注册的用户名为:');
101
+ availableUsernames.forEach((name, index) => {
102
+ process.stdout.write(`${name} `);
103
+ if ((index + 1) % 10 === 0) process.stdout.write('\n');
104
+ });
105
+ } else {
106
+ console.log('未找到可注册的用户名');
107
+ }
108
+
109
+ } catch (error) {
110
+ console.error('执行出错:', error);
111
+ }
112
+ }
113
+
114
+ // 启动
115
+ main();
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "smolapp",
3
+ "version": "0.0.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "keywords": [],
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": "",
12
+ "dependencies": {
13
+ "username-checker": "^0.1.1"
14
+ }
15
+ }