python

How to dynamically update management IP on DigitalOcean

Mar 24, 2022 Cloud, Design, Cloud-dev-machine, Digital-Ocean, python

Steps: Generate a token for API access: Navigate through API -> Tokens/Keys, click the button Generate New Token Give it a name and write permission. The key will only show once after confirming the key details, so make a good copy for it Find firewall for management, or create one if there isn’t one Use the a.external { background: url('/images/external.png') no-repeat 100% 0; background-size: 14px 14px; padding-right: 16px; } API to list all policies and look for a policy named mgmt in the response that should be similar to the following: ...

Walkthrough of Fibonacci Golf

Mar 16, 2022 python, CHECKIO

题目需求 题目的原意可以总结为:以尽量简洁的方式,完成各种类Fibonacci计算。 提到的类型有: fibonacci: f(0)=0, f(1)=1, f(n)=f(n-1)+f(n-2) tribonacci: f(0)=0, f(1)=1, f(2)=1, f(n)=f(n-1)+f(n-2)+f(n-3) lucas: f(0)=2, f(1)=1, f(n)=f(n-1)+f(n-2) jacobsthal: f(0)=0, f(1)=1, f(n)=f(n-1)+2*f(n-2) pell: f(0)=0, f(1)=1, f(n)=2*f(n-1)+f(n-2) perrin: ...

Walkthrough of Probably Dice

Mar 16, 2022 python, CHECKIO

题目需求 题目的原意可以总结为:求N个M面骰子(骰子点数为1-M)掷出X点数的概率。 其中,N,M,X依次为我们需要编写的函数的三个参数。返回值 ...

Better process for zsh virtualenvwrapper plugin

Mar 16, 2022 python, plugin, shell, virtualenv, zsh

Virtualenvwrapper is one of the must-have scripts for building a Python development environment. With the power of zsh oh-my-zsh plugin framework, we can automate some processes such as activate & deactivate. But the build-in virtualenvwrapper fails to work sometimes what it should be. I decided to fix it by myself after googling for existed solutions. virtualenvwrapper plugin analyze & optimize The existed virtualenvwrapper plugin is quite useful in most of the time, but it would malfunction occasionally. ...

Walkthrough of CheckIO Inside Block

Mar 16, 2022 python, CHECKIO

After a long absence, I returned to continue playing CheckIO tasks by a notification mail. The UI had been optimized a lot and the tasks were still as interesting as the before. a.external { background: url('/images/external.png') no-repeat 100% 0; background-size: 14px 14px; padding-right: 16px; } Inside Block required checking whether a given point is inside a polygon or not. After some research on google, I found a practical method. ...

Walkthrough of Text Holes Golf

Mar 16, 2022 python, CHECKIO

冲分的时候又到了!! 题目要求 题目要求一如既往的简单明了: 统计一段文字中,有多少空格满足周围都不是空格字符的数量 而原始代码嘛…… def golf(text): return 0 思路 我 ...

CheckIO - Snake

Mar 16, 2022 Programming, python, CHECKIO

a.external { background: url('/images/external.png') no-repeat 100% 0; background-size: 14px 14px; padding-right: 16px; } http://www.checkio.org/mission/task/info/snake/python-27/ 呀〜贪吃蛇啊…… 和其他的task不同的是,这个是一次multicall。不过我其实完全可以不考虑这点,每次给出当 ...