lua

小米路由器LuCI Web服务

旧时模样 提交于 2020-12-15 08:46:23
首先SSH进入小米路由器,具体办法看 http://www1.miwifi.com/miwifi_open.html 开启SSH服务。 LuCI的主文件目录在 /usr/lib/lua/luci dispatcher.lua中说明了 controller文件夹是控制器, view是模板目录 来源: oschina 链接: https://my.oschina.net/u/3861161/blog/1839731

How to align text using pandoc with lua-filters?

半城伤御伤魂 提交于 2020-12-15 01:56:02
问题 How to align all h1 headers of the pdf to center using pandoc with lua-filters? I have the test.md file bellow: <center> # Chapter 1 </center> <right> ## Sub-1-1 </right> <left> ### Sub-1-2 </left> <center> # Chapter 2 </center> <right> ## Sub-2-1 </right> <left> ### Sub-2-2 </left> And I need to align center all "Chapters" to center, all the "Sub- -1" to right and all the "Sub- -2" to left using tags as above, to stay like: Chapter 1 Sub-1-1 Sub-1-2 Chapter 2 Sub-2-1 Sub-2-2 I can uppcase

How to align text using pandoc with lua-filters?

无人久伴 提交于 2020-12-15 01:53:03
问题 How to align all h1 headers of the pdf to center using pandoc with lua-filters? I have the test.md file bellow: <center> # Chapter 1 </center> <right> ## Sub-1-1 </right> <left> ### Sub-1-2 </left> <center> # Chapter 2 </center> <right> ## Sub-2-1 </right> <left> ### Sub-2-2 </left> And I need to align center all "Chapters" to center, all the "Sub- -1" to right and all the "Sub- -2" to left using tags as above, to stay like: Chapter 1 Sub-1-1 Sub-1-2 Chapter 2 Sub-2-1 Sub-2-2 I can uppcase

Lua编程入门(一)

本秂侑毒 提交于 2020-12-13 10:53:41
Lua编程入门(一) 1.简介 Lua 是一门扩展式程序设计语言,被设计成支持通用过程式编程,并有相关数据描述设施。同时对面向对象编程、函数式编程和数据驱动式编程也提供了良好的支持。它作为一个强大、轻量的嵌入式脚本语言,可供任何需要的程序使用。Lua 由 clean C(标准 C 和 C++ 间共通的子集) 实现成一个库。 作为一门扩展式语言,Lua 没有 “main” 程序的概念:它只能 嵌入 一个宿主程序中工作,该宿主程序被称为 被嵌入程序 或者简称 宿主 。 宿主程序可以调用函数执行一小段 Lua 代码,可以读写 Lua 变量,可以注册 C 函数让 Lua 代码调用。依靠 C 函数,Lua 可以共享相同的语法框架来定制编程语言,从而适用不同的领域。Lua 的官方发布版包含一个叫做 lua 的宿主程序示例,它是一个利用 Lua 库实现的完整独立的 Lua 解释器,可用于交互式应用或批处理。 2.基本概念 2.1值与类型 Lua 是一门 动态类型语言 。这意味着**变量没有类型;只有值才有类型。**语言中不设类型定义。所有的值携带自己的类型。 注意: Lua 中所有的值都是 一等公民 。这意味着所有的值均可保存在变量中、当作参数传递给其它函数、以及作为返回值。 2.2八种基本类型 Nil: 只有值nil属于该类,表示一个 无效值 (在条件表达式中相当于false);

Download and build Lua with modern CMake

我是研究僧i 提交于 2020-12-13 04:03:03
问题 Let's try to build lua via cmake! Motivation: cmake is gaining more attention and support through IDEs like CLion or even Visual Studio 2017 (and newer). This is great if you want to provide platform-independent open-sources and faciliate the entire build-process. Now the problem is that creating a proper CMakeLists.txt isn't that straightforward in my opinion: cmake_minimum_required(VERSION 3.16) include(ExternalProject) set(LUA_VERSION "lua-5.3.5") ExternalProject_Add(lua URL https://www

Download and build Lua with modern CMake

雨燕双飞 提交于 2020-12-13 04:01:33
问题 Let's try to build lua via cmake! Motivation: cmake is gaining more attention and support through IDEs like CLion or even Visual Studio 2017 (and newer). This is great if you want to provide platform-independent open-sources and faciliate the entire build-process. Now the problem is that creating a proper CMakeLists.txt isn't that straightforward in my opinion: cmake_minimum_required(VERSION 3.16) include(ExternalProject) set(LUA_VERSION "lua-5.3.5") ExternalProject_Add(lua URL https://www

Check if Table contains a value in lua

[亡魂溺海] 提交于 2020-12-12 12:14:30
问题 I am looking for a method to see if the value is in array (table) The example table has 3 entries, each entry containing a table with multiple entries Say I am checking if 'apple' is in 'data' data = { {"alpha","bravo","charlie","delta"}, {"apple","kiwi","banana","pear"}, {"carrot","brocoli","cabage","potatoe"} } This is the code I have, a recursive query. The problem is the function breaks somewhere as it drops the positive value local function hasValue(tbl, str) local f = false for ind, val

spring boot redis分布式锁

我是研究僧i 提交于 2020-12-12 02:36:06
一. Redis 分布式锁的实现以及存在的问题 锁是针对某个资源,保证其访问的互斥性,在实际使用当中,这个资源一般是一个字符串。使用 Redis 实现锁,主要是将资源放到 Redis 当中,利用其原子性,当其他线程访问时,如果 Redis 中已经存在这个资源,就不允许之后的一些操作。spring boot使用 Redis 的操作主要是通过 RedisTemplate 来实现,一般步骤如下: 将锁资源放入 Redis (注意是当key不存在时才能放成功,所以使用 setIfAbsent 方法): redisTemplate.opsForValue().setIfAbsent("key", "value"); 设置过期时间 redisTemplate.expire("key", 30000, TimeUnit.MILLISECONDS); 释放锁 redisTemplate.delete("key"); 一般情况下,这样的实现就能够满足锁的需求了,但是如果在调用 setIfAbsent 方法之后线程挂掉了,即没有给锁定的资源设置过期时间,默认是永不过期,那么这个锁就会一直存在。所以需要保证设置锁及其过期时间两个操作的原子性,spring data的 RedisTemplate 当中并没有这样的方法。但是在jedis当中是有这种原子操作的方法的,需要通过 RedisTemplate 的

出招吧!腾讯专家手敲《Redis源码日志笔记》,不服来对打!

放肆的年华 提交于 2020-12-10 19:42:04
引言 本文分为六个部分,包括 Redis 源码日志,服务框架,基础数据结构,内功心法,应用,其他,从源码层面循序渐进的了解Redis。可以快速、有效地了解Redis 的内部构造以及运作机制,更好、更高效地使用Redis。 本文框架如下 第一部分,主要是在阅读代码过程中的日志和笔记; 第二部分,主要介绍了 Redis 的主要框架,以及 Redis 是如何提供服务的,从一个最简单的命令开始讲起; 第三部分,主要介绍 Redis 底层用作存储的数据结构,这一部分很有趣; 第四部分,主要讲解了 Redis 的核心功能,包括持久化,订阅/发布模式,主从复制,事务机制,集群等等; 第五部分,展示了 Redis 几个简单的应用; 第六部分,介绍了 Redis 和 Memcached 的区别,以及稍稍讲解了 Memcached。 Tips:本文内容已经整理成了pdf版本,内容由真实腾讯专家手写,感兴趣的朋友可以通过【一键三连本文】方式获取到腾讯专家手写Redis源码日志笔记pdf版本! 获取下载方式,点击获取!暗号:CSDN Redis服务框架 ①初探 Redis Redis 在缓存系统所处的位置 ②Redis 事件驱动详解 事件驱动数据结构 事件循环中心 Redis 事件驱动原理 事件注册详解 准备监听工作 为监听套接字注册事件 事件循环 事件触发 ③Redis 是如何提供服务的

尝试将 Jed 作为你的 Linux 终端文本编辑器 | Linux 中国

和自甴很熟 提交于 2020-12-10 10:54:48
Jed 方便的下拉菜单,让新用户可以轻松地使用终端文本编辑器。 来源: https:// linux.cn/article-12901- 1.html 作者:Seth Kenlon 译者:geekpi (本文字数:2802,阅读时长大约:3 分钟) 你可能听说过 Emacs、Vim 和 Nano 这些典型的 Linux 文本编辑器,但 Linux 有大量的开源文本编辑器,我的目标是在 12 月份对其中的 31 个文本编辑器进行一次公平的测试。 在这篇文章中,我将介绍 Jed ,它是一个基于终端的编辑器,它的特点是有一个方便的下拉菜单,这让那些刚刚接触终端编辑器的用户,以及那些不喜欢记住每个功能的组合键的用户而言变得特别容易。 安装 Jed 在 Linux 上,你的发行版软件仓库可能会让 Jed 通过你的软件包管理器安装: $ sudo dnf install jed 并不是所有发行版都是如此,但它是一个很容易从源码编译的应用。首先,下载 S 语言 (Jed 的编写语言)并安装(其中 x.y.z 请替换为对应的版本号): $ wget https://www.jedsoft.org/releases/slang/slang-x.y.z.tar.bz2 $ tar xvf slang*bz2 $ cd slang-x.y.z $ ./configure ; make $ sudo