2023年1月7日星期六

[solved]Amazon Linux 2 encounter 'warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory' after 'yum update'

Little trick to fix the  'warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory' issue on amazon linux 2 after yum update.


Thanks to this post:  thought it is japanese, but the solving trick is the same.

https://nyan.blog/2021/10/11/ec2amazon-linux-2%E3%81%A7%E3%80%8Cyum-update%E3%80%8D%E3%81%97%E3%81%9F%E3%82%89%E3%80%8Cfailed-to-set-locale-defaulting-to-c%E3%80%8D%E3%81%8C%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%82%8B/


[Description]

After yum update,  CLI prompted with following message ,

```

-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory

-bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory

-bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory

-bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory

-bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory

```

and   export LC_ALL="en_US.UTF-8" won't work.

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)


$ ll /usr/lib/locale/  and you will only find C.utf8

  C.utf8

  locale-archive.tmpl


$ locale

locale: Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_MESSAGES to default locale: No such file or directory

locale: Cannot set LC_ALL to default locale: No such file or directory

LANG=en_US.UTF-8

LC_CTYPE="en_US.UTF-8"

LC_NUMERIC="en_US.UTF-8"

LC_TIME="en_US.UTF-8"

LC_COLLATE="en_US.UTF-8"

LC_MONETARY="en_US.UTF-8"

LC_MESSAGES="en_US.UTF-8"

LC_PAPER="en_US.UTF-8"

LC_NAME="en_US.UTF-8"

LC_ADDRESS="en_US.UTF-8"

LC_TELEPHONE="en_US.UTF-8"

LC_MEASUREMENT="en_US.UTF-8"

LC_IDENTIFICATION="en_US.UTF-8"

LC_ALL=en_US.UTF-8



[How to solve it]  

If you are using en_US.UTF-8, following will do:

$sudo localedef -f UTF-8 -i en_US en_US.UTF-8




2022年12月3日星期六

Dell DA300, macOS 10.14 + 复活记 The revive of DELL DA300 on macOS later version


DELL DA300 is an USB-C adaptor,small,cute, and embedded with strong display extension for Displayport/ HDMI / ethernet, USB-C/USB-A, even legacy VGA. 

Problem, the network interface seems not working after macOS 14.(for win10,it is still a go). This post will show you the way to revive DA300 on mojave/big sur/monterey macOS on intel based mac computers.

Dell homepages said it supports macOS 12. The real problem is that after macOS 14, the realtek network interface card (which boarded on DA300)  is not longer supported by macOS. Good news is that realtek provided the upgrade for later macOS.

Download page:

https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software

find the following dirver.


MAC OS 10.9 to 10.15 ,    for the day I am writing this post (Dec 2022)  , it is 1.0.22, 2020/12/21

Install. And be aware that, after the installation , the network interface card will not pop up and work directly, you need a few clicks to select the network interface card and just 'Apply': 

Following are quotes from manufacture's software description: 

  This is the Mac OS X  driver for Realtek 8152B/8153/8156. The system will be rebooted after the driver is installed, so please close all the other applications before installing the driver. After the system is rebooted, please follow the following steps to configure the network:

1. Select the "System Preference" from the system menu.

2. Select and launch the "Network" item in the "System Preference" folder.

3. From the "Configure" list, select the adapter to be configured.

4. Configure the settings.

5. Click the "Save" button.

Then you can connect to the Ethernet.......


NOTE: This driver is for Mac OS X 10.9 or later versions on the Intel-based Mac. 



DELL released DA300 around 2018, and it is unfortunate that there are no information about the support on later version of macOS.  Obviously, they show more enthusiastic on supporting successors as DA310.





2021年3月14日星期日

 MCT  Oil 要注意C12比例 ,  苹果醋要纯正  ,   say No to  MCT粉 


苹果醋好多种哦, 最好是买纯正苹果醋吧,其实价格不会差太多。 有些加了酒精成分的苹果醋不要乱喝哦,喝了小心驾车呼气检测不过被认为是酒驾就不划算了。  曾经有中国国内的吃了藿香正气水,被检测酒驾的悲剧。

至于韩国美醋系列,你看看它简直就是添加剂大全。。。不知道是在喝什么了...


MCT Oil 的迷思

市场上 MCT Oil很多,但是大家要注意哦, 许多只是椰子油提炼品,

MCT 还可以细分成 C6、C8、C10、C12 这四种。数字越小,进入肝脏的 速度越快,生酮效果也 越好。 

简单说: C8越高越好,C12越少越好.


天然食物中,棕榈仁油椰子油奶制品(奶酪、母乳)中都含有比较多的 MCT,但这些食物中包含的 “MCT“,几乎是由 C12 组成的月桂酸,真正能通过肝门静脉的 比例非常低。

至于MCT粉,就是扯淡了,他们还会加一些碳水化物在里面,你做生酮岂不是白搞了。

所以   不要吃 MCT粉啦!


日本选择:

Nature's Way  30 fl.oz 

https://www.amazon.co.jp/gp/product/B0747B7X2Z

它的正常售价是 2740日元, 不要上日亚的当,它会有时候搞杀人价,你耐心等待就好了。

这个C8 : C10  大概 60%:39%,  C12 小于 1% . 


大陆选择:

 买 VIVA , 32 fl.oz 大概 170RMB 左右,它的C8:C10 61: 38, C12 小于 1%


总之不要买 sport research, 它里面有 30%都是 C12 ,可以说非常不地道了。










汽车蓄电池(电瓶) 电力不足(亏电)怎么办 -- 清洁能源解决方案



汽车长期放置或者经常跑短途等其他各种原因,会导致蓄电池电力不足,使得汽车不能以全功能方式运行 , 尤其是一些有 自动启停 功能的汽车,行车计算机会关闭自动启停功能, 甚至建议以长距离驾驶来获得电力,这个非常的不环保(不经济)。

本文提出了一种经济的保持汽车蓄电池电力充足的方法。

实施对象:  BMW 3系  320i, 320li 等 (其他品牌乘用车都可以运用同样方法,主要区别在于 汽车蓄电池的位置不同  )


准备材料:   

35瓦单晶硅太阳能电池板  尺寸 1000x 180 mm ,厚度约 3mm
适合安装在后备箱盖板, 不需要安装到车顶

MPPT 太阳能控制器 (负责过充,短路,限流 的保护) 推荐 北京绿能精电的tracer系列 1206 AN  即可满足


               
                 

2020年4月7日星期二

便携太阳能设备的实际使用比较: 薄膜 vs 单晶硅


For TLDR:
   

     薄膜太阳能发电  (小板)没有实际使用意义;  单晶硅折叠包的发电能力可观。


薄膜太阳能  VS  单晶硅

       薄膜太阳能的代表产品是汉能, 特别是汉能  48w 折叠发电纸(产品代号: SC50-MDF ) ,  100w 折叠发电纸 系列.

      包括7.7瓦 汉能薄膜发电纸 ,除了炫技之外,毫无实际意义 无法真正的充电. 
      市面上有一些产品介绍在汽车挡风玻璃后面用太阳能给汽车蓄电池充电,是彻头彻尾的骗局,实测衰减了车外最佳角度 90%的功率,电流仅100mA 左右.

   
汉能 薄膜太阳能折叠发电纸50W SC50-MDF
(实际为48瓦)

      汉能的薄膜发电纸确实非常轻,  48瓦 (质量约 830g )大约能在上午10点 (天候温和,纬度不高也不低) 的时候,调整到最佳角度,也只能提供12V ,1A 的电流(可以接mppt也可以不接mppt控制器).    如果隔一层玻璃 汽车前挡或者窗户,将衰减到 0.1A  -0.2 A 左右,


     如果不接太阳能控制器,可能只适合接充电宝(需要很长时间充电)。 即使汉能厂家也建议不要直接连接手机使用.(虽然它提供了点烟器转USB口适配)


     如果要给手机供能,建议加上稳压设备,或者太阳能控制器.
     而一般的单晶硅板在同等光照条件和相同负载的情况下,100W 太阳能电池板可以达到12V,5A的供电能力.  减半面积也有 2A.

    目前测试发现,薄膜发电能力远低于其标称能力. (可能需要mppt的配合加适当的日照吧)
   
For newbie:
      不要上当看一些业余评测讲开路电压或者最大功率点电压x电流, 开路电压没有意义,带上负载就会降下来; 最大功率点的功率,需要mppt太阳能控制器配合才能达到,尤其是可能还需要对应的光照达到对应瓦数.
      汉能产品说明书所要求的标准测试条件如下:

      1000kW / m2 ,  1.5倍光谱, 组件测试温度 25 摄氏度

 
参考:

   太阳常数 1362 kW/m2 , 包括所有形式太阳辐射.

以下来自wikipedia:
太阳常数太阳电磁辐射通量,也就是距离太阳一天文单位处(约为地球离日平均距离),单位面积受到垂直入射的平均太阳辐射强度。太阳常数包括所有形式的太阳辐射,不是只有可见光。由人造卫星测出的最小值约1.361 kW/m²,最大值约为1.362 kW/m²,差了1%。[1]太阳常数并不是科学技术数据委员会颁布的真正不变的物理常数,而只是一个变动值的平均,在过去400年间变动小于0.2%

)





  • 单晶硅太阳能电池板  实验样本:  "AP奥鹏" 太阳能折叠包  100瓦   重量2150克


    在和汉能发电纸同等条件下,可以录得12V  5A 的电流.  (上午10时, 中等纬度,20 摄氏度左右气温)

    带两个USB口,一个DC输出(此输出口可以录得12V 5A 电流) 

    下图为厂商图, 与实际商品近似。

AP奥鹏  100瓦 太阳能折叠包







2018年8月23日星期四

mac OS 和Linux 通用伎俩: 命令行下 多线程下载工具 axel vs. wget

wget 大家都知道,但是只能单线程下载,遇到大文件就很苦恼。

mac OS ,  Linux 可以分别通过 homebrew, 和 yum 安装 axel


操作简单好用

axel  -n  线程数  targetURL



--

https://amzn.to/2EPHPJb

2018年7月22日星期日

Evernote 的代码块的显示效果的调整



参考:
https://zhuanlan.zhihu.com/p/22458733



Mac evernote , 需要从evernote.com 下载其App才有codeblock的效果,在Mac AppStore版本的evernote 没有代码块效果。


修改代码块效果的方法:

修改ce.css

reinhard 备注:
evernote  7.2.3 的修改方法:


Line 1010:
en-codeblock {
  background-color: #eee;
  padding: 2px 8px;
  font-family: monospace;
  box-sizing: border-box;
  padding: 8px;
  font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #333333;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
  background-color: #fbfaf8;
  border: 1px solid rgba(0, 0, 0, 0.14902);
  background-position: initial initial;
  background-repeat: initial initial;
}


修改其中:

background-color: #eee;   
background-color: #fbfaf8;        color: #333333;   

改为:
  background-color: #333;


 color: #BFBFBF;

上面显示的codeblock 的效果即新颜色的效果。

2018年6月6日星期三

如何发财(不靠运气) Howto Get Rich(wthout getting lucky)

How to Get Rich (without getting lucky):   
原作:twitter: @naval 
翻译:  twitter:  @reinsgold
如何发财(不以撞大运的方式)

Seek wealth, not money or status. Wealth is having assets that earn while you sleep. Money is how we transfer time and wealth. Status is your place in the social hierarchy.
追求财富,而不是钞票或者社会地位。财富是拥有能够在你睡觉的时候都挣钱的资产。钞票是我们用于转换时间和财富的工具。社会地位是你在社会架构中的位置。
Understand that ethical wealth creation is possible. If you secretly despise wealth, it will elude you.
理解不带原罪的财富创造是可能的。如果你暗暗地鄙视财富,它也将离你远去。
Ignore people playing status games. They gain status by attacking people playing wealth creation games.
忽略那些玩社会地位游戏的人。他们通过攻击玩财富创造游戏的人来获得社会地位。
You’re not going to get rich renting out your time. You must own equity - a piece of a business - to gain your financial freedom.
依靠出租自己的时间是无法发财的。你需要拥有财产- 一个商业项目 - 来获得你的财富自由。
You will get rich by giving society what it wants but does not yet know how to get. At scale.
你可以通过给社会提供社会所需要的但是它还不知道如何获得的东西来发财。规模化的。
Pick an industry where you can play long term games with long term people.
选择一个你能够长期持久的行业,可以长期合作的人群。
The Internet has massively broadened the possible space of careers. Most people haven't figured this out yet.
internet已经大大的扩展了可能的职业发展空间。许多人还没有发现这件事。
Play iterated games. All the returns in life, whether in wealth, relationships, or knowledge, come from compound interest.
玩迭代游戏。所有的一生中的回报,无论是财富,关系, 知识,均来自于复利。
Pick business partners with high intelligence, energy, and, above all, integrity.
选择具有高智商,能量的合作伙伴,尤其是可靠。
Don't partner with cynics and pessimists. Their beliefs are self-fulfilling.
不要和愤世嫉俗者,悲观主义者作伙伴。他们的信仰是自我实现。
Learn to sell. Learn to build. If you can do both, you will be unstoppable.
学会销售,学会建造,如果你两件事都能做,你将无往不利。
Arm yourself with specific knowledge, accountability, and leverage.
用专有的知识,责任感和杠杆来武装自己。
Specific knowledge is knowledge that you cannot be trained for. If society can train you, it can train someone else, and replace you.
专有的知识是指无法通过培训获得的知识。如果社会能够培训你,也同样能培训别人来替代你。
Specific knowledge is found by pursuing your genuine curiosity and passion rather than whatever is hot right now.
专有的知识时通过追寻你原生的好奇心和热情来获得的,而不是时下热点。
Building specific knowledge will feel like play to you but will look like work to others.
建造专有的知识对你感觉起来像游戏,而对别人看起来像工作。
When specific knowledge is taught, it’s through apprenticeships, not schools.
专有知识的传授是通过实践,而不是学校。
Specific knowledge is often highly technical or creative. It cannot be outsourced or automated.
专有知识通常是高度技术性的或者创造性的。它无法外包或者自动化。
Embrace accountability, and take business risks under your own name. Society will reward you with responsibility, equity, and leverage.
勇敢承担责任,并且在你的名下承担商业风险。社会将回报你以更大的担当,业务和杠杆。
The most accountable people have singular, public, and risky brands: Oprah, Trump, Kanye, Elon.
最可靠的人们往往拥有单一的,公众的,有风险的品牌:奥普拉·温弗里, 川普,Kanye West, Elon Musk.
“Give me a lever long enough, and a place to stand, and I will move the earth.”
- Archimedes
给我一个足够长的杠杆和一个站立的基点,我可以撬动地球。  阿基米德
Fortunes require leverage. Business leverage comes from capital, people, and products with no marginal cost of replication (code and media).
财富需要杠杆。商业的杠杆来自于资本,人,和没有复制时边际成本的产品(代码和多媒体)
Capital means money. To raise money, apply your specific knowledge, with accountability, and show resulting good judgment.
资本意味着钱。为了增长纸面财富(钞票),应用你的专有知识,并为此承担责任,表现良好判断力。
Labor means people working for you. It's the oldest and most fought-over form of leverage. Labor leverage will impress your parents, but don’t waste your life chasing it.
劳动力意味着人们为你工作。这是最古老的,而且最经常被争抢的杠杆形式。劳动力的杠杆将让你的父母辈满意,但是别浪费你的时间来追求它。
Capital and labor are permissioned leverage. Everyone is chasing capital, but someone has to give it to you. Everyone is trying to lead, but someone has to follow you.
资本和劳动力是被公众认可的杠杆。所有人都在追寻资本,但是总需要有人来提供资本。每个人都试图去做领导者,但是总需要有人来跟随你。
Code and media are permissionless leverage. They're the leverage behind the newly rich. You can create software and media that works for you while you sleep.
代码和媒体不是那么被公众认可的杠杆。他们是财富新贵们的杠杆。你可以创造软件或者媒体,他们在你睡觉的时候都为你打工(挣钱)。
An army of robots is freely available - it's just packed in data centers for heat and space efficiency. Use it.
机器人的队伍是随处可见的。-它只是为了节能和空间的需要而龟缩在数据中心。把它用起来。
If you can't code, write books and blogs, record videos and podcasts.
如果你不能编码,写博客和书吧,录影开设podcast.
Leverage is a force multiplier for your judgement.
杠杆是一个你判断的强制放大器。
Judgement requires experience, but can be built faster by learning foundational skills.
判断需要经验,但是能够通过学习基础技能而快速获得。
There is no skill called “business.” Avoid business magazines and business classes.
没有一种叫做“商业”的技能。不要去参加商业课程或者杂志。
Study microeconomics, game theory, psychology, persuasion, ethics, mathematics, and computers.
学习微观经济学,博弈论,心理学,说服术,伦理,数学和计算机。
Reading is faster than listening. Doing is faster than watching.
阅读比倾听要快。实干比观察要快。
You should be too busy to “do coffee," while still keeping an uncluttered calendar.
你没有时间去"搞咖啡"的同时还拥有一个 
Set and enforce an aspirational personal hourly rate. If fixing a problem will save less than your hourly rate, ignore it. If outsourcing a task will cost less than your hourly rate, outsource it.
设定并不断提高你个人的工时费用。如果解决一个问题所能产生的效益小于你的工时费,忽略它。如果外包一个任务的成本小于你的工时费,就外包出去。

Work as hard as you can. Even though who you work with and what you work on are more important than how hard you work.
尽你所能努力工作,哪怕是你所协同工作的人和你所做的事情比你如何努力要重要的多。
Become the best in the world at what you do. Keep redefining what you do until this is true.
在你所在的领域里成为世界上最好的。不断的校正重新定义你所做的事情,知道它是你真正所做的事情。
There are no get rich quick schemes. That's just someone else getting rich off you.
没有发财支付的捷径,那些只是别人比你赚更多钱的方法。
Apply specific knowledge, with leverage, and eventually, you will get what you deserve.
不断的应用知识,带着杠杆,(黄天不负有心人)最终你将得到你应得的。
When you're finally wealthy, you'll realize that it wasn't what you were seeking in the first place. But that's for another day.
当你最后终于发财了,你将意识到这并不是你最初所追求的。但是,这是后话了。

2018年5月16日星期三



linux 上一个有趣的bash 增强脚本

https://www.tecmint.com/jm-shell-a-customized-bash-shell-for-linux/




但是在 macOS 上工作的不好,但是可以修正,稍后放到github上.

不要买MacID 这个软件,蓝牙音频断续的罪魁祸首 pitfall in Bluetooth on MacID

macOS,  蓝牙,音频,卡顿,断续,中断的罪魁祸首(之一)

症状: 安装MacID  的苹果macOS 系统, 蓝牙连结音箱/耳机播放音频/音乐时,会感觉到明显的非周期性频繁卡顿,断续 等问题,

踩坑注意,勿入此陷阱