Submitted by gouki on 2021, November 22, 5:58 PM
2014的MAC闲置2年多了,总想着不应该就此吃灰,所以决定装个windows,现在都2021年了,怎么也不能装win7了吧。结果,问题就这么来了。。。。
现在的win10大多是大于4G,导致在创建启动U盘的时候说磁盘空间不够。老人们都知道,FAT32格式,文件最大只能4G,这是历史遗留问题了。。。怎么破。
网上教程很多,我这里只贴链接不贴内容了。。
1、如何解决install.wim文件大于4G?boot camp只认fat32的问题? - 二虫的回答 - 知乎 https://www.zhihu.com/question/304531344/answer/545226343,只是他文中的那个下载地址已经失效了。到底O不OK也未知
2、然后还是同一篇:如何解决install.wim文件大于4G?boot camp只认fat32的问题? - zhu的回答 - 知乎 https://www.zhihu.com/question/304531344/answer/853791420,这里面的地址还活着,但点过去说,这个文件已经不再支持。但我们的老电脑应该还能用。。。。
3、MacBook Pro mid2010 安装High Sierra & Win10双系统 https://zhuanlan.zhihu.com/p/371577644
4、 Mac安装Win10系统教程 https://zhuanlan.zhihu.com/p/60019927
说白了,就是几种办法
1、找个老版本小于4G的 iso
2、把4G拆开
3、两个分区,用GRUB来处理。。
4、-----买个windows笔记本其实也OK
主要是我还是闲置机,所以忍一下。
苹果相关 | 评论:0
| 阅读:6073
Submitted by gouki on 2021, October 29, 3:33 PM
因为最近在用valet,然后把MAMP PRO都干掉了(不能怪我啊,实在是MAMP PRO6的一些使用太反人类了。。。不知道作者是怎么想的),但现在想想反正也就是这样简单的使用,干脆就用valet了算了。其实也可以用laravel sail的。但因为4月份之前,M1版的mac上的docker都不正常。所以,就暂时放弃了,现在用用valet也算OK。80%的情况下都OK
创建个目录,valet link一下就完事了。因为现在都是laravel的项目,用起来也算方便,毕竟也是官方的工具。但因为我用frp,所以我设置valet tld 真实的域名(比如:xxx.com),这就造成,我访问demo.xxx.com,访问的是127.0.0.1,然后我映射在外面的server也是demo.xxx.com,其实这一切都OK了。然而问题是,有时候我要测试真实域名,比如就是 demo.xxx.com ,我就只能打开全局梯子。这样我访问demo.xxx.com才对应了 frp的域名。
听起来有点绕口令,说白了就是,因为用了真实域名,所以我默认访问都是本地,但外网访问我都是真实的。而我如果要测试真实的网址,反而还要爬个梯子。虽然影响不大,但还是想换换,于是我就想,valet 是不是可以允许绑定两个域名?这样的话,是不是就全解决了?本地测试一个域名,一个域名公开对外。
找了一些文章,发现默认是不支持,但有人通过hack的方法(说白了就是改模板,改配置改代码。。。。)支持了。原文在这里:https://medium.com/@simonhamp/supporting-multiple-tlds-in-laravel-valet-e3d2a963c613
我简单的COPY了一下,没排版,要看详细的,还是直接看原版吧:
XML/HTML代码
- Valet is great.
- Occasionally though I need an app to respond on a different TLD to the default one. And there are even times when it makes sense to have an app respond on multiple TLDs (e.g. to prove some multi-domain functionality).
- You may have some secure assets hosted by a third-party that requires domain verification (FontAwesome Pro). In development, that may mean it’s easier to be using the same domain as other devs on the team than add loads of different dev domains to the service’s whitelist.
- In the current release of Valet, this kind of functionality isn’t natively available. Even in third-party packages like Valet+, this isn’t supported. But with a few quick changes it’s easily possible. Let me show you how.
- Dnsmasq
- First we’ll need to update the Dnsmasq config so that it will handle multiple TLDs.
- Turns out this is really easy. Valet holds some config in ~/.config/valet/dnsmasq.conf.
- In there we just need to add some config for each TLD we want to support. Add the following two lines for every TLD you want to support. Replace {tld} with the TLD, unsurprisingly.
- address=/{tld}/127.0.0.1
- listen-address=127.0.0.1
- Then restart Dnsmasq:
- sudo brew services restart dnsmasq
- Valet
- Now we just need to update the Valet code to support multiple domains.
- Firstly, we’re going to add some values to our ~/.config/valet/config.json. I’ve opted for simply adding keys rather than changing any existing one. I’ve added a tlds array. This will be used later.
- {
- ...
- "tlds": [
- "tld1",
- "tld2"
- ]
- }
- Then we just need to edit some Valet files and run some commands.
- All of these edits I’m making directly in my globally-installed Valet (~/.composer/vendor/laravel/valet/).
- // server.php, line 70
- $siteName = basename(
- // Filter host to support wildcard dns feature
- valet_support_wildcard_dns($_SERVER['HTTP_HOST']),
- '.'.$tld
- );
- // change to:
- foreach ($valetConfig['tlds'] as $tld) {
- if (strpos($_SERVER['HTTP_HOST'], '.'.$tld) === false) {
- continue;
- }
- $siteName = basename(
- // Filter host to support wildcard dns feature
- valet_support_wildcard_dns($_SERVER['HTTP_HOST']),
- '.'.$tld
- );
- }
- This just allows the server to respond to whichever one of the TLDs we want to support.
- Now let’s update the CLI so we can generate and remove SSL certs for all of the TLDs (valet secure and valet unsecure commands). Firstly, secure:
- // cli/valet.php, line 145, secure command
- $app->command('secure [domain]', function ($domain = null) {
- $url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['tld'];
- Site::secure($url);
- Nginx::restart();
- info('The ['.$url.'] site has been secured with a fresh TLS certificate.');
- })->descriptions('Secure the given domain with a trusted TLS certificate');
- // change to:
- $app->command('secure [domain]', function ($domain = null) {
- $urls = [];
- foreach (Configuration::read()['tlds'] as $tld) {
- $url = ($domain ?: Site::host(getcwd())).'.'.$tld;
- Site::secure($url);
- $urls[] = $url;
- }
- Nginx::restart();
- $urls = implode(', ', $urls);
- info('The ['.$urls.'] site has been secured with a fresh TLS certificate.');
- })->descriptions('Secure the given domain with a trusted TLS certificate');
- And now the unsecure command:
- // cli/valet.php, line 158, unsecure command
- $app->command('unsecure [domain]', function ($domain = null) {
- $url = ($domain ?: Site::host(getcwd())).'.'.Configuration::read()['tld'];
- Site::unsecure($url);
- Nginx::restart();
- info('The ['.$url.'] site will now serve traffic over HTTP.');
- })->descriptions('Stop serving the given domain over HTTPS and remove the trusted TLS certificate');
- // change to:
- $app->command('secure [domain]', function ($domain = null) {
- $urls = [];
- foreach (Configuration::read()['tlds'] as $tld) {
- $url = ($domain ?: Site::host(getcwd())).'.'.$tld;
- Site::secure($url);
- $urls[] = $url;
- }
- Nginx::restart();
- $urls = implode(', ', $urls);
- info('The ['.$urls.'] site will now serve traffic over HTTP.');
- })->descriptions('Stop serving the given domain over HTTPS and remove the trusted TLS certificate');
- Finally, run the following command:
- valet restart
- Enjoy
以上是仅复制未排版,嫌丑的看原文:https://medium.com/@simonhamp/supporting-multiple-tlds-in-laravel-valet-e3d2a963c613
如果不用梯子看不了,就将就点吧
Tags: valet, docker, frp
PHP | 评论:0
| 阅读:5751
Submitted by gouki on 2021, October 26, 9:11 PM
系统升级到12后。Moom打不开了,在命令行直接open,显示Bus Error,一下子想不到怎么弄,干脆,不用了,换成hammorspoon,然后单独配置。
由于我用moom其实主要就是用了5组窗口(其实常见7种),1、左右 各50%,2:40:60,3、4/13,9/13,4:100%
1、50:50,用于放微信和QQ窗口
2、40:60,用于放便签和word,在高分屏下,word,如果全屏,反而字很小,干脆放60%左右
3、4/13和9/13,用于放终端和IDE,还有一组是MAC模拟器和Code(写flutter的时候用得上)
4、100%,用于给浏览器使用
配置,我把0.4的去掉了。
配置如下:
XML/HTML代码
- hs.window.animationDuration = 0
- units = {
- right50 = { x = 0.50, y = 0.00, w = 0.50, h = 1.00 },
- left50 = { x = 0.00, y = 0.00, w = 0.50, h = 1.00 },
- left_4_13 = { x = 0.00, y = 0.00, w = 4/13, h = 1.00 },
- right_9_13 = { x = 4/13, y = 0.00, w = 9/13, h = 1.00 },
- maximum = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 }
- }
- hs.hotkey.bind({"alt" }, "1", function()
- hs.window.focusedWindow():move(units.left50, nil, true)
- end)
- hs.hotkey.bind({"alt" }, "2", function()
- hs.window.focusedWindow():move(units.right50, nil, true)
- end)
-
- hs.hotkey.bind({"alt" }, "5", function()
- hs.window.focusedWindow():move(units.left_4_13, nil, true)
- end)
-
- hs.hotkey.bind({"alt" }, "6", function()
- hs.window.focusedWindow():move(units.right_9_13, nil, true)
- end)
-
- hs.hotkey.bind({"alt" }, "0", function()
- hs.window.focusedWindow():move(units.maximum, nil, true)
- end)
代码里没有0.4/0.6的,自己配一下就可以了,上述命令其实是:alt+数字,为什么用这个,是因为这个快捷键的冲突比较小(几乎没有见到有冲突)
如果复制不方便,还可以看这个gist:https://gist.github.com/neatstudio/ec8a26ed237e4a98667a878d8fd3c8cd
Tags: gist, moom, hammerspoon
苹果相关 | 评论:0
| 阅读:6321
Submitted by gouki on 2021, October 12, 12:25 PM
突然间不知道这个算是该放在哪个分类了,毕竟ziggy在github上的项目,也是src为PHP,dist是JS
ziggy是一个优秀的、配合laravel使用的、适合用于SAP项目的一个前端组件。对于laravel来说,他只是主要实现了一个@route的方法,放在blade模板里就行了。至于是全放还是部分放,那就看你怎么配置的了:https://github.com/tighten/ziggy#filtering-routes,比如debug相关的就应该去掉。如果前后端项目有分离,那更应该用@route(['group'])的方式来处理。
对于前端来说,那就更方便了,他提供了一个route的方法,可以直接用laravel路由的名字。比如route('home.index'),会生成相应的路由。如果你要用在axios或者其他里面,你得 使用url()方法,比如route('home.index').url()生成一个字符串。
ziggy的用法有很多,即使你不使用blade模板,官方也都提供了适用的方法,说多了也没啥用,看这里就行了:https://github.com/tighten/ziggy#filtering-routes
常用方法:
route('home.index') => 对应 Route::get()->name('home.index')
route('home.index',[1,2]) =>对应 Route::get('/aaa/{a}/bbb/{b}')->name('home.index') ,允许传入数据当成 参数传递
route('home.index' , {a:1,b:2}) ,同样对应上面的路由,也就是说他第二个参数除了可以传入数组外,也可以传入对象
如果你有用laravel 的route.binding功能,他生成链接的时候,会根据你在Model里的getRouteKey来输出URL,参考:https://github.com/tighten/ziggy#route-model-binding
更多的还是看官方吧。。。。
PHP | 评论:0
| 阅读:5376
Submitted by gouki on 2021, October 9, 4:32 PM
几个常用命令
1、pstree -ap|grep php ,这是以树型进行展示 ,如果有括号,基本上就是僵尸
2、ps -A -o stat,ppid,pid,cmd | grep -e '^[zZ]' ,如果有,那就是僵尸。毕竟都Z了
有兴趣的在遇到僵尸后可以strace -p跟进一下,没兴趣就直接:kill -HUP id 或者 kill -9 id了
当然,最好还是strace一下,这样方便排查问题,而不至于后面会频繁出现。遇到问题不要急着重启nginx和php-fpm,排查一下,不然下次可能还会出现
其他方法
1、ps -aux|grep -v "grep\|nginx\|php-fpm" | grep php
Tags: strace, pstree
PHP | 评论:0
| 阅读:5997