IT漫步

技术生活札记©Yaohui

Install nvidia-340 driver on Ubuntu 20.04.3 LTS

在一台旧PC上安装了Ubuntu 20.04.3 LTS, 显卡是”微星N240GT-MD 暴雪512/D5″, 芯片是 Nvidia Geforce GT240, 需要安装显卡驱动 》 先是从nvidia官方网站根据显卡型号下载了NVIDIA-Linux-x86_64-340.108.run 安装过程中提示: asm/kmap_types.h: No such file or directory 没有找到有效解决办法 》 google一番后尝试直接安装nvidia-340驱动 sudo apt install nvidia-340 也是安装失败, 主要的错误是: dpkg: error: version ‘-‘ has bad syntax: revision number is empty Setting up lib32gcc-s1 (10.3.0-1ubuntu1~20.04) ... Setting up vdpau-driver-all:amd64 (1.3-1ubuntu2) ... Setting up nvidia-340 (340.108-0ubuntu5.20.04.2) ... dpkg: …


A config file for Raspberry Pi 4B with OpenWrt to working as an AP

# cat /etc/config/wireless config wifi-device 'radio0' option type 'mac80211' option path 'platform/soc/fe300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1' option hwmode '11a' option htmode 'VHT40' option channel 'auto' option country '00' config wifi-iface 'wifinet0' option ssid 'OpenWrt' option encryption 'none' option device 'radio0' option mode 'ap' list maclist 'XX:XX:XX:XX:XX:XX' option macfilter 'allow' option network 'lan'


Gitlab Omnisharp package – Change LDAP DN for external user

Scenario: Change DN from “cn=李小李,ou=IT中心,ou=XX公司,dc=xx,dc=com” to “cn=李小李,ou=HR Dept,ou=XX公司,dc=xx,dc=com” for user #11. Step 1 – Connect to boundled PostgreSQL database # sudo gitlab-psql -d gitlabhq_production psql (10.9) Type "help" for help. gitlabhq_production=# Refer to: https://docs.gitlab.com/omnibus/settings/database.html#connecting-to-the-bundled-postgresql-database Step 2 – Search user DN by user id in the psql shell gitlabhq_production=# select * from identities where provider = …



yum is broken after upgrade python from 2.x to 3.x on CentOS 7

yum is broken after upgrade python from 2.x to 3.x on CentOS7: # yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ Resolution: modify /usr/bin/yum and /usr/libexec/urlgrabber-ext-down, change first line from “#!/usr/bin/python” to “#!/usr/bin/python2”: #!/usr/bin/python2 import sys try: import yum except ImportError: print >> sys.stderr, """\ ... #! /usr/bin/python2 # A very simple external downloader …


Setup Windows development environment for Tencent-BlueKing Standard OPS

1. Install Python 2.7 and npm tool 2. Clone source code from: https://github.com/Tencent/bk-sops 3. Run cmd shell, change current directory to root path of bk-sops 4. Install required packages by run: pip install --proxy={proxy if any} -r requirements.txt 5. Open url “http://{BK_PAAS_HOST}/admin/app/app/” of your BlueKing paas platform, copy app-code and token for app “标准运维”(bk_sops) 6. …


Win10打开休眠模式

升级正式版win10以后,发现竟然没有休眠选项,从电源管理器里面也没有找到,有时候有些重要的工作,希望第二天打开直接在第一天的状态,不用重新打开各种文件,而电脑又没必要开一整夜,于是必需要打开休眠选项。 以管理员权限进入命令行 输入命令: powercfg /a 查看电脑支持的睡眠模式,是否休眠未打开 如果未打开,然后输入 powercfg /h on 最后再用命令:powercfg /a 查看是否打开了休眠。 如果已经打开了,就可以去电源管理器中去设置了。 在开始菜单上右键,选择电源选项,   选择“选择电源按钮的功能”,   单击“更改当前不可用的设置,   单击“更改当前不可用的设置”,   选择需要的设置“休眠”,   最后 “保存修改” 这样打开开始菜单,选择“电源”现在可以休眠了 ——————— Refer:https://blog.csdn.net/saindy5828/article/details/72857332


What is the difference between services.AddTransient, service.AddScoped and service.AddSingleton methods in ASP.NET Core?

1. Transient objects are always different; a new instance is provided to every controller and every service. 2. Scoped objects are the same within a request, but different across different requests. 3. Singleton objects are the same for every object and every request. Refs: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.2#service-lifetimes-and-registration-options https://stackoverflow.com/questions/38138100/what-is-the-difference-between-services-addtransient-service-addscoped-and-serv


基于docker stack部署wordpress

1. Docker Hub上有关于wordpress部署方式的说明,我们使用docker stack方式部署wordpress,为便于部署其它应用,在wordpress前面部署了nginx进行反向代理,docker-compose.yml文件内容如下: nginx处在frontend和backend网络中 wordpress处在backend网络中 mysql处在backend网络中 nginx的配置文件夹,html目录内容,log文件夹镜像到主机上(文件夹映射会自动在host与container之间同步,文件则不会,所以volumes bind最好用文件夹) mysql的数据文件夹镜像到主机上 wordpress的完整目录(/var/www/html)镜像到主机上 wordpress安装目录下的wp-content文件夹保存了所有的插件及上传文件,但主程序(.php文件)在上层文件位中,为了以后的主程序升级,我们把整个目录镜像出去备份 version: "3.3" services: nginx: image: nginx:1.13.8 deploy: mode: "global" labels: - "position=frontend" resources: limits: cpus: "0.1" memory: 50M restart_policy: condition: any ports: - "80:80" volumes: - type: "bind" source: "/etc/nginx/" target: "/etc/nginx/" read_only: true - type: "bind" source: "/var/www/html/" target: "/usr/share/nginx/html" read_only: true …


Git常用操作

有新代码提交后文件冲突,不能pull代码,Git不能像SVN那样自动Merge,可: git stash git pull git stash pop 比较两个commit之前的修改,生成patch文件并apply到其它地方: git diff {较早commit hash} {较新commit hash} > MyPatch.diff git apply MyPatch.diff 从其它分支提取某一个提交并apply到当前分支: git cherry pick {某次commit hash} git reset [<mode>] [<commit>] mode: –hard 放弃本地修改, 重置所有文件状态和修改内容 –mixed 重置所有文件状态, 保留文件内容 –soft 保留本地文件状态和内容 commit commit hash, HEAD, origin/<branch name>

Proudly powered by WordPress