- 关闭gradle自动构建功能: View -> Tool Windows -> Gradle -> 点击Toggle Offline Mode
- 使用命令行构建android安装包,避免即使在android studio内设置proxy也无法下载某些特定文件: export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087; ./gradlew build
分类:技术
技术
JS项目内使用node运行js脚本
需要在一个JS项目内通过运行js脚本导入数据到mongodb内。由于在脚本内需要引入项目内node_modules的库,使用命令行查看:node -> module ,已经可以使用node_modules的库文件。不过在js脚本要使用require来导入库,如下:
const bcryptjs = require('bcryptjs'); data = bcryptjs.hashSync('123456'); console.log(data); module.exports = {data};
MySQL减少内存占用
之前买了一台512MB内存的VPS用于搭建wordpress,使用时经常报数据库连接错误。使用nmon或top命令查看占用内存最多的是mysql和apache2服务,apache2通过这篇文章解决。mysql的performance_schema
主要用于收集数据库服务器性能参数,适当调小可以减少内存占用,甚至可以修改配置将其关闭。
[mysqld]
performance_schema=OFF
ImportError: cannot import name ‘appengine’ from ‘requests.packages.urllib3.contrib error on pipeline
这是由于最新的requests包不支持urlib3 2.0.0,可以通过kfp-2.0.0b16
(see PR with the change)解决,也可以降级urllib3的版本:
pip install urllib3==1.26.15
使用 NobePay 开卡订阅 ChatGPT Plus 全流程(转载)
启动npm测试开发服务
有时需要直接测试js服务状态,开通某一个端口,启动服务:
npm run dev --host ip_address --port port
doesn’t work.
npm run dev -- --host ip_address --port port
works.
cloudflare dns 1.1.1.1 域名污染
从昨晚到现在使用MacOS访问国内网站均指向182.43.124.6这个ip的网页(
), 后来反应过来查看dns:
nslookup zhihu.com
Server: 1.1.1.1 Address: 1.1.1.1#53 Non-authoritative answer: Name: zhihu.com Address: 182.43.124.6
笔记本上的DNS Servers的1.1.1.1已经被投毒了,后续删除这个域名服务器(不知道之前是怎么加入进来的),同时清除域名缓存,到此虚惊一场。
MACOS 版本 | 使用的命令 |
---|---|
macOS 12 (Monterey) | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
macOS 11 (Big Sur) | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
macOS 10.15 (Catalina) | sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |
macOS 10.14 (Mojave) | sudo killall -HUP mDNSResponder |
macOS 10.13 (High Sierra) | sudo killall -HUP mDNSResponder |
macOS 10.12 (Sierra) | sudo killall -HUP mDNSResponder |
OS X 10.11 (El Capitan) | sudo killall -HUP mDNSResponder |
OS X 10.10 (Yosemite) | sudo discoveryutil udnsflushcaches |
OS X 10.9 (Mavericks) | sudo killall -HUP mDNSResponder |
OS X 10.8 (Mountain Lion) | sudo killall -HUP mDNSResponder |
Mac OS X 10.7 (Lion) | sudo killall -HUP mDNSResponder |
Mac OS X 10.6 (Snow Leopard) | sudo dscacheutil -flushcache |
Mac OS X 10.5 (Leopard) | sudo lookupd -flushcache |
Mac OS X 10.4 (Tiger) | lookupd -flushcache |
使用v2ex感受
V2EX作为程序员和设计师聚集的网站有一定的知名度,后来因为国内的内容审核成本迁移到海外。最近注册一个账号 https://www.v2ex.com/member/jerry0903 ,说下使用这个网站的一些体会:
1. 注册一个月后才可以发文章
主要是为阻止大量账号灌水,发广告。这个对新用户来说确实有些体验不好。
2. 主要使用markdown格式写文章,图片只能引用链接,不能在网站文章编辑添加图片或必须付费
markdown对普通用户有些门槛,图片这个操作有些不习惯
3. 文章发布后无法修改,只能追加,不能删除
跟主流的blog操作不同,勉强能够接受
4. 不能删除用户的恶意评论
这个是体验最差的,不能屏蔽或删除恶意评论,那个就像一坨翔放在你家门口,对创作者感受最差
5. 不能删除账号
这个确实是奇葩,跟国内那些app或网站一个德行
最后总结一下,整个体验过程太糟糕了,以后也不会在这个网站写任何文章,拜拜了!
Mastodon更换域名
最近给mastodon实例更换域名,发现用户的logo和之前发的图片无法显示,原因是这些都指向之前的域名。最后是LOCAL_DOMAIN还没有更改过来。操作如下:
进入mastodon目录, vi .env.production
修改LOCAL_DOMAIN为现在的域名
Next.js Edge Functions 超时问题
最近使用Next.js框架开发gpt-4应用,发现调用gpt-4返回结果是超过30秒就出现timeout提示。在fetch函数添加各种timeout选项问题依然存在。后面找寻时发现:
“Edge Functions have a timeout of 30 seconds and even longer when streaming, which far exceeds the timeout limit for serverless functions on Vercel’s Hobby plan. Using these can allow you to get past timeout issues when using AI APIs that take longer to respond. As an added benefit, Edge Functions are also cheaper to run.”
也就是说使用streaming功能的函数(包含ReadableStream关键字)必须是edge,即在函数后面添加:
export const runtime = “edge”;
这样即使超过30秒也不会报错。
https://vercel.com/docs/concepts/functions/edge-functions/streaming