Crontab setting when minute ends in a specific digit - cron

Just interested in the shortened version of the following for the minutes interval:
5,15,25,35,45,55
8,18,28,38,48,58
I know they essentially the same, just a different ending digit.
Thanks.

The definition in the initial question is as short as it can be made.

This should do the trick:
5,15,25,35,45,55 * * * * yourcommand
8,18,28,38,48,58 * * * * yourcommand

Just put 8,18,28,38,48,58 etc in the 'minutes' field.
Ie:
8,18,28,38,48,58 * * * * /path/to/command

Related

Dealing with numbers outside of uint256 range

i am trying to build compound formula with solidity but I have came across a problem, given enough days, the amount is compounded, amount will overflow uint256 range.
I have read that as long as final result is in the range of uint256, it should be fine but it does not seem to be the case. here is the calculation that i am trying to do
(100 * (100+8)^100) * 10^(6 - 2*100)
as a formula it looks like this:
( BASE * ( (1 * 10^MULTIPLIER) + (YIELD * 10^MULITPLIER) ) ^ COMPOUNDED_DAYS ) * ( 10 ^ (DECIMALS - MULTIPLIER * COMPOUNDED_DAYS) )
as mentioned this is compound formula with 6 decimals, but when i run this in playground i get "0" as a result. what's the problem, and if there is problem how can i fix it?
The reason is that your number becomes smaller than one and the integer turns it into zero
The caret sign ^ represents a bitwise XOR - not an exponential multiplication. If you want to calculate "to the power of", use two asterisks **.
Example: "10 to the power of 2" in Solidity: 10 ** 2

Vim: sorting with levels

I have the following file with Markdown markup:
* [B](B)
* b
* c
* [C](C)
* [A](a)
* a
I try to sort it and get the following result:
* [A](a)
* a
* [B](B)
* b
* c
* [C](C)
It is necessary to sort only the main levels, and sub-levels must follow the main levels, i.e., stay at the levels where they were. The first thing that comes to mind is of course :sort; but unfortunately this will also sort the sub-levels. We will get:
* a
* b
* c
* [A](a)
* [B](B)
* [C](C)
Are there any tricks or plugins for this kind of sorting? Thx!
The usual approach for this class of problems is to inline each block, then sort them, and then "de-inline" them back to their original state.
First step: inline each block.
We do this by replacing each EOL followed by SPACE-SPACE-STAR with some fancy symbol unlikely to be found in our document:
:%s/\n\( \*\)/§\1
Which gives us the following:
* [B](B)§ * b§ * c
* [C](C)
* [A](a)§ * a
Second step: sort the buffer.
We simply use :help :sort:
:sort
to obtain this:
* [A](a)§ * a
* [B](B)§ * b§ * c
* [C](C)
Third step: revert each "block" to its initial state.
We do this by reverting the substitution above with another, much simpler, one:
:%s/§/\r
which gives us the desired outcome:
* [A](a)
* a
* [B](B)
* b
* c
* [C](C)
A couple of notes:
The exact pattern to use in the first substitution depends on the exact structure of your document. That part is, IMO, too highly contextual to be generalisable.
§ is just an example, use whatever symbol you want.

Crontab expression in Spring

I am trying to make a scheduled task where cron job executes after every 15 minutes, but I am confused about seconds.
I have made the following cron: ("* 0/15 * * * *") . Is it same as
("0 0/15 * * * *") [Note the second part here]. I mean in online I have seen examples where seconds is replaced by 0, but other fields with *. So my question is, if I replace seconds field with *, then is it same as with 0 ?

The structure of the uTorrent's uTorrentPartFile.dat

I'm trying to make a small utility that should automate some maintenance tasks of the uTerrent's pool of torrents. To veryfy the hashes of partially downloded shares, I have to retrieve the parts of the pieces, that are not completely contained by the downloaded files, from the ~uTorrentPartFile_XXX.dat file where uTorrent keeps them. This raises two questions:
Given a certain .torrent file, how do I compute the name of the corresponding ~uTorrentPartFile_XXX.dat file (namely, the hexadecimal string that uTorrent uses instead of my XXX)
Where can I find information about the inner structure of the file that would allow me to retrieve the required data from it? Google's failed to help.
The BiglyBT team has reverse engineered the ~uTorrentPartFile_XXXX.dat format when they created a migration plugin.
https://www.biglybt.com/download/utMigrate
https://github.com/BiglySoftware/BiglyBT-plugin-migratetorrentapp
From: https://github.com/BiglySoftware/BiglyBT-plugin-migratetorrentapp/blob/master/src/com/biglybt/plugins/migratetorrentapp/utorrent/PartFile.java
/**
* uTorrent partfile
* Basically, torrent data is split into 64k parts. Header has 4 byte index for
* each part, pointing to data if index is > 0.
* After the header is the 64k data chunks, first data chunk is 1, second is 2, etc.
* Last data chunk may be smaller than 64k.
*
* ~uTorrentPartFile_*<hexsize>*.dat
* <Header>, <data>
*
* hexsize
* torrent data length in bytes in hex with no leading 0
*
* Header
* <DataIndex>[<Num64kParts>]
* Raw header length = <Num64kParts> * 4
*
* Num64kParts
* How many parts is required if you split torrent data length into 64k sections.
* ie. Math.ceil(torrent data length in bytes / 64k)
*
* DataIndex
* 4 byte little endian integer. Values:
* 0
* No data for this 64k part
* 1..<num64Parts>
* 1-based positional index in <data>
* Location in part file can be calculated with
* (Header Size) + ((value - 1) * 64k)
*
* data
* <DataPart>[up to <num64kParts>]
*
* DataPart
* 64k byte array containing torrent data.
* Bytes in <DataPart> that are stored elsewhere in real files will be 0x00.
* ie. non-skipped files sharing the 64k part will be 0x00.
* Last <DataPart> may be less than 64k, which means the rest of the 64k would
* be 0x00 (and part of a non-skipped file)
*
*/
Bonus
There is also some useful information about the content in resume.dat and settings.dat in the code comments here:
https://github.com/BiglySoftware/BiglyBT-plugin-migratetorrentapp/blob/master/src/com/biglybt/plugins/migratetorrentapp/utorrent/ResumeConstants.java
https://github.com/BiglySoftware/BiglyBT-plugin-migratetorrentapp/blob/master/src/com/biglybt/plugins/migratetorrentapp/utorrent/SettingsConstants.java

Difference in Macro vs Manual Output on same formula using LOG

Well its rather a very strange question
I have a macro which generates the delta of a Option(d1):
Function dOne(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend)
dOne = (Log(UnderlyingPrice / ExercisePrice) + (Interest - Dividend + (0.5 * Volatility ^ 2)) * Time) / (Volatility * (Sqr(Time)))
End Function
When I pass the the values to it, it generates the desired output:
However when I try to replicate this in Excel, it gives an entirely different output
I know that the calculations for output generated manually are correct.
However the desired values are those generated from VBA.
Please suggest what am I missing here.
The Log function in VBA is the natural log: ln(x).
The LOG function in the formula is log base 10: log10(x).
If you want log base 10 in VBA you will have to use the logarithmic identity for converting bases:
Log(x)/Log(10)
In your case
dOne = (Log(UnderlyingPrice / ExercisePrice) / Log(10) + (Interest - Dividend + (0.5 * Volatility ^ 2)) * Time) / (Volatility * (Sqr(Time)))

Resources