分类 其他 下的文章

3月10号晚上,我在v2ex上看到了这篇帖子 《JetBrains Quest,解开可获得全家桶三个月免费订阅》 https://www.v2ex.com/t/651662,当时准备已经洗完澡,准备休息了,看到这个,勾起了我的兴趣,虽然我用的是Community的版本……

No.0

首先看第一步,给出了一串文本,如下:

48 61 76 65 20 79 6f 75 20 73 65 65 6e 20 74 68 65 20 73 6f 75 72 63 65 20 63 6f 64 65 20 6f 66 20 74 68 65 20 4a 65 74 42 72 61 69 6e 73 20 77 65 62 73 69 74 65 3f

从这个文本来看,应该是16进制的文本, 直接将这个16进制转换成文本试下:

x = '4861766520796f75207365656e2074686520736f7572636520636f6465206f6620746865204a6574427261696e7320776562736974653f'
print(bytes.fromhex(x).decode('utf-8'))

果然,结果是:

Have you seen the source code of the JetBrains website?

那就去JetBrains的官网看看

- 阅读剩余部分 -

3月11日,今天晚上到家,发现v2ex上又有人发出来JetBrains的第二道解谜了,就又参与了。

谜题是在JetBrains的twitter发布的:

Time for the next #JetBrainsQuest!
.spleh A+lrtC/dmC .thgis fo tuo si ti semitemos ,etihw si txet nehw sa drah kooL .tseretni wohs dluohs uoy ecalp a si ,dessecorp si xat hctuD erehw esac ehT .sedih tseuq fo txen eht erehw si ,deificeps era segaugnal cificeps-niamod tcudorp ehT

No.1

这段文字一看就像倒过来的,使用python进行reverse处理:

print(".spleh A+lrtC/dmC .thgis fo tuo si ti semitemos ,etihw si txet nehw sa drah kooL .tseretni wohs dluohs uoy ecalp a si ,dessecorp si xat hctuD erehw esac ehT .sedih tseuq fo txen eht erehw si ,deificeps era segaugnal cificeps-niamod tcudorp ehT"[::-1])

得到结果:

The product domain-specific languages are specified, is where the next of quest hides. The case where Dutch tax is processed, is a place you should show interest. Look hard as when text is white, sometimes it is out of sight. Cmd/Ctrl+A helps.

No.2

下一个谜题藏身于JetBrains的一款DSL工具中,参加过第一个谜题的话,应该会注意到,上次谜题中的MPS就是这个工具。打开MSP的网址:https://www.jetbrains.com/mps/

找到有关“Dutch tax”的地方,这个是一个case study,叫做“Agile Law Execution Factory”,介绍是“Domain-specific languages to implement Dutch tax legislation and process changes of that legislation.”,点击下面的“Read MPS case study”,是一个pdf文件,地址是:https://resources.jetbrains.com/storage/products/mps/docs/MPSQuest_DTO_Case_Study.pdf

下载好这个pdf文件,然后我使用chrome打开,乍一看下去,没有任何线索。但是上面的提示中,说到有些文本是白色的,使用Ctrl+A进行帮助,我就Ctrl+A然后Ctrl+C,再Ctrl+V到vscode中,发现有下面这一段话:

This is our 20th year as a company,
we have shared numbers in our JetBrains
Annual report, sharing the section with
18,650 numbers will progress your quest.

其实,这段话就位于第一页首部右侧的空白区域内。

- 阅读剩余部分 -

这次是JetBrains的最后一个谜题了。

No.0

在twitter上JetBrains发布了最后一个谜题的线索:

SGF2ZSB5b3Ugc2VlbiB0aGUgcG9zdCBvbiBvdXIgSW5zdGFncmFtIGFjY291bnQ/

这个大小写加数字加斜杠的组合,让人一下想到了base64,解一下,果然是:

Have you seen the post on our Instagram account?

No.1

去到JetBrains的ins看下,最新一条图片的标题就是“JetBrains Quest”,他的内容是:

Welcome to the final Quest! You should start on the Kotlin Playground: https://jb.gg/kotlin_quest
P.S. If you don’t know about the #JetBrainsQuest, it’s not too late to find out.

打开提示的网址 https://jb.gg/kotlin_quest,有这么一段代码:

fun main() {
   val s = "Zh#kdyh#ehhq#zrunlqj#552:#rq#wkh#ylghr#iru#wkh#iluvw#hslvrgh#ri#wkh#SksVwrup#HDS1#Li#zh#jdyh#|rx#d#foxh/#lw#zrxog#eh#hdv|#dv#sl1"

    val n: Int = TODO()
   for (c in s) {
       print(c - n)
   }
}

这个文本的样子,非常像第一个谜题中的caesar解法,然后就是这个shift要试下,最终这个shift是3,所以这个代码最终是下面这个样子:

fun main() {
    val s = "Zh#kdyh#ehhq#zrunlqj#552:#rq#wkh#ylghr#iru#wkh#iluvw#hslvrgh#ri#wkh#SksVwrup#HDS1#Li#zh#jdyh#|rx#d#foxh/#lw#zrxog#eh#hdv|#dv#sl1"

    val n: Int = 3
    for (c in s) {
        print(c - n)
    }
}

执行结果是:

We have been working 22/7 on the video for the first episode of the PhpStorm EAP. If we gave you a clue, it would be easy as pi.123

- 阅读剩余部分 -

我转到现在这个海外事业部的时候,这边使用的开发环境和测试环境都是docker。每个开发者都有自己的docker开发环境,自测通过后,部署到测试环境。

但是使用的时候,发现开发环境和测试环境都有一个问题,就是不论是service还是portal的日志,每30分钟就被清空了,我以为是被log4j归档了,看了下归档文件夹,里面有这个日志文件,但是文件为空。

这个问题实实在在困扰我了好久,因为无法追查历史日志,导致测试报问题的时候,只能去重现实时tail日志,非常麻烦。

我一开始以为就是log4j配置的归档时间是每30分钟,但是我看了log4j的配置文件,是1个小时,线上也是这个配置,线上没有这个问题。

后来我怀疑,是不是这个docker本身对某些卷定时操作,但是我看了下docker的启动配置,也没有。

并且,每个人的开发环境和测试的测试环境都有这个问题,很很很很奇怪!

再来后,开发任务紧张,这件事就放下了。

- 阅读剩余部分 -

首先,crontab要执行的任务要有输出日志,表明任务执行过。

然后,另起一个crontab任务,去监控上面的这个日志,比较日志的更新时间,判断任务是否执行,从而提醒。

下面是我在实际生产环境中使用的一个脚本示例:

timestamp() {
  date +"%s"
}
url="http://报警url"

last_mofidy_timestamps="$(stat -c %Y /home/example/example.log)"
echo $last_mofidy_timestamps

current_timestamps="$(timestamp)"
echo $current_timestamps

if (($current_timestamps - $last_mofidy_timestamps > 3600)); then
    curl $url
fi