中年大叔还有梦可以做么?


原文在 中年大叔还有梦可以做么?  




我的20岁到30岁都是在英国度过的,具体来说,20-22岁的时候特别苦,本科毕业后很迷茫,又是机缘巧合才拿到了奖学金并在25岁完成博士学位,再之后遇上媳妇 @happyukgo 后日子就特别平淡。但是最近有娃后的几年,我时不时的都在考虑一个问题:我到底有没有梦想?难道 老婆孩子热坑头 这就是一辈子的追求和梦想?梦想和风险是共存的,时不我待,但年纪已然很尴尬,中年大叔,有了梦想已经无法像20出头的小伙敢闯敢拼,今后何去何从还未知。


中年大叔真的还有梦可以做么?


PS: 此文为 @jubi 谷哥点名 第三期参赛作品



Originally published at https://steemit.com Thank you for reading my post, feel free to Follow, Upvote, Reply, ReSteem (repost) @justyy which motivates me to create more quality posts.


原创 https://Steemit.com 首发。感谢阅读,如有可能,欢迎Follow, Upvote, Reply, ReSteem (repost) @justyy 激励我创作更多更好的内容。 


 // 稍候同步到我的中文博客 



近期热贴 Recent Popular Posts





 https://justyy.com

https://weibomiaopai.com

https://helloacm.com

https://uploadbeta.com

https://rot47.net

https://codingforspeed.com

https://zhihua-lai.com

https://steakovercooked.com

https://happyukgo.com

https://isvbscriptdead.com

https://propagationtools.com/

https://steemyy.com

https://anothervps.com 




https://justyy.com/gif/steemit.gif



This page is synchronized from the post: 中年大叔还有梦可以做么?

The Best Upvoting Strategy Calculator in Javascript - 怎么样点赞收益最高? (新老用户都来看看)

In my previous post), a question was raised: How to upvote in order to maximize the payout per day?

之前说到 第一次打肿脸充胖子 - 花了200STEEM租1万SP四周! 那么就扯到了怎么样点赞收益最高的问题。

Things could get very complicated, so we make some assumptions:

由于实际情况复杂(比如每个人睡眠时间不同,碎片时间段不一样),所以我们来做一个大胆但合理有效的假设:

We assume that you start with a P (Voting Power, with P=1 equals 100% voting power), and we know that 100% vote costs around 2% voting power. Each 36 minutes, you get 0.5% voting power restored.

假设我们用 P 来表示每个人每天固定时间段起始的 能量,满血就是100%。我们已经知道,每100%点一次需要耗掉2%血量。并且每36分钟回0.5%的血量。

And we know that the 100% voting power generates M dollar payout. If you only upvote T times and that happens only in a specific N-hours timespan e.g. from 10:00AM to 10:00PM (after that, you go to sleep).

并且已经每次100%点的收益是M美元,如果每个人计划这一天点T次赞,并且只有在一个N小时的时间段内可以点赞(比如醒着的时候)。

The straightforward voting strategy will be to use all T upvotes at the beginning of the timespan.

这时候,我们可以来看一种点赞方式:

The payout equation will be:

在这个固定的时间段就把这T次全点完,那么这样的收益为:

1
Sum P*M*(1-0.02*(i-1)) for i=1..T

For example, when T=2, upvoting twice immediately after start will be:
比如T=2的时候,在最开始就点完两次赞的收益为:

1
P*M + P*M*(1-0.02)

Translated into Javascript, the code explains the idea:
这样翻译成Javascript代码就是:

1
2
3
4
5
6
7
8
9
10
11
12
// P - Current Voting Power e.g. 100%
// M - Payout at 100% unit $
// T - Number of Upvotes
// N - Number of Hours (Interval)
function calcPayout0(P, M, T, N) {
var x = 0;
for (var i = T; i > 0; -- i) {
x += P * M;
P -= 0.02; // 2% voting power decrease 能量最多为100%
}
return x;
}

However, if the starting power is not 100%, it is always wait till the end of the timespan, when we have bigger voting power. With a line added, we have a better version:
但我们这么一样,如果我们在最开始的时候能量P不为100%,我们可以完全等到时间段结束的时候恢复投票能量了再一起点,那么这样的话,上面的代码稍微改一下,加一行,就得到了第二个版本:

1
2
3
4
5
6
7
8
9
10
11
12
13
// P - Current Voting Power e.g. 100%
// M - Payout at 100% unit $
// T - Number of Upvotes
// N - Number of Hours (Interval)
function calcPayout1(P, M, T, N) {
var x = 0;
P = Math.min(1, P + 0.005 / 0.6 * N); // Maximum 100% voting power, 能量最多为100%
for (var i = T; i > 0; -- i) {
x += P * M;
P -= 0.02; // 2% voting power decrease 每次100%点损失2%能量
}
return x;
}

Every 36 minutes we got 0.5% voting power back, that is we restore 0.005/0.6 each hour. Another strategy is to divide the N hour time span into T-1 slots, so with the energy restores at each slots, the equation becomes:
每36分钟恢复0.5% 也就是说每小时恢复 0.005/0.6。嗯,有点意思,还有没有其它点赞方法?有的,我们可以把这N小时时间平均分成T - 1次来点,这样的话,我们需要加上每段时间能量的恢复,公式为:

1
Sum P*M*(1-0.02*(i-1)+R) for i=1..T

R is the energy restored per N/(T-1), using JS explains better.
其中R为每段N/(T-1)时间内恢复的能量,我们用JS代码来解释清楚一些:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// P - Current Voting Power e.g. 100%
// M - Payout at 100% unit $
// T - Number of Upvotes
// N - Number of Hours (Interval)
function calcPayout2(P, M, T, N) {
var x = 0;
var sp_restored = 0;
if (T == 1) {
P = Math.min(1, P + 0.005 / 0.6 * N);
} else {
var sp_restored = 0.005 / 0.6 * (N / (T - 1));
}
for (var i = T; i > 0; -- i) {
x += P * M;
P -= 0.02; // 2% loss per 100% upvote 每次100%点损失2%能量
P += sp_restored; // each 36 minutes restore 0.5% 能量每36分钟回复0.5%
}
return x;
}

The equation can be uniformed by extracting M which is like a constant. We use M=270 because @abit gives roughly 270$ per 100% upvote. A bigger M will make the result analysis clear.
我们注意到,M可以被单一化提取出去(不影响大小判断),不过为了让结果更清楚,我们选择M=270美元(据说 @abit 100%点赞是270美元)

我们来比较几组值 STEEMIT UPVOTING STRATEGY DATA ANALYSIS

Disclaimer: I am not responsible for your payout.. These are just for your references (and may contain error)
以下数据(很有可能有错误)仅供参考!本人不对您的收益负责。

When you only upvote once 当你只每天只点1次赞的时候

1
2
var T = 1;
var N = 10;

You can upvote when you wake up, or when the VP restores - vote before you go to bed. If P=0.9, the three methods generate payouts of:
这时候,可以在开始点,可以在最后能量恢复了的时候点,很显然,如果起始能量P=0.9,那么三种方式的结果为:

1
2
3
calcPayout0=243
calcPayout1=265.5
calcPayout2=265.5

The Voting Power cannot restore to 100% in 10 hour span, that is why the maximal payout is 265.5 instead of 270. Clearly, voting when you have a higher voting power is the best choice.
因为能量在10个小时内恢复不到100%,所以最大收益为265.5 元(100%的情况下是270美元),显然,等能量恢复大了收益高一些。

However, if the starting power is 100%, it does not make any difference, they all give $270 payout.
但如果起始能量就是100%了,这样的情况下是没有区别的,三种方案都是270美元。

When you upvote 8 times per day 当你每天点8次赞

Starting Voting Power P=100%, T=8, N=10, The third strategy is better (vote and rest)
起始能量P=100%,T=8,N=10。第三种点一次等恢复一点能量再点这种明显收益就更高:

1
2
3
calcPayout0=2008.8
calcPayout1=2008.8
calcPayout2=2098.8

However, when the P is 80% at the begining of timespan:
但是如果是这组值:起始能量是80%

1
2
3
4
var P = 0.8;
var M = 270;
var T = 8;
var N = 10;

The second method gives a higher payout. That is, you use your 8 upvotes immediately before you go to bed when you have already restored to a higher VP for the day.
这样的结果反而是第二种方式好,也就是说等到能量恢复到最大的时候一起点(比如你一天早上都不点,等到晚上你睡觉前再一下子全部点完8次):

1
2
3
calcPayout0=1576.8
calcPayout1=1756.8
calcPayout2=1666.8

When the P is closest to 100%, the third strategy (vote and rest) is better than the second one.
只有在初始能量接近100%的情况下,第三种方式才有会高于第二种:

1
2
3
4
var P = 0.99;
var M = 270;
var T = 8;
var N = 10;

Does this result surprise you?
结果有没有很让人很意外?

1
2
3
calcPayout0=1987.2
calcPayout1=2008.8
calcPayout2=2077.2

There are, of course, other voting strategies, for example, you can use half your votes in the morning and the rest in the evening. But I guess the results are pretty much similar (the analysis could go further). My suggestions according to the fact that most Steemians won’t have a higher P at the beginning of each day:
当然还有其它种策略:比如最开始时间段先点1半,最后睡觉前再点完剩下的1半。你也可以写相应的程序来验证一下。但是不管如何,大部分人的每天起始能量不为100%,或者像我经常点赞点到少于70%,这种情况下,也就是第二种方式会好一些:

Use your votes right before you go to bed!
就是睡觉前统统点完你的指标!

Most of use won’t care so much because our M is small compared to big whales.. For example, my M = 1.7.
当然,请记住,上面的计算是基于270美元单次点击得到的结果,如果像我现在M=1.7的情况:得到的结果很接近:

1
2
3
calcPayout0=12.512
calcPayout1=12.648
calcPayout2=13.0786666666667

The results are very close: So, don’t spend too much time considering your best voting strategy. You should spend more time in your posts on SteemIt!
所以,我想大部分人都不需要操这个心,因为小鲸鱼们点一次才多少钱,各种点赞策略其实不会差太多,倒不如花时间在如何提高文章的质量上。

我们都不需要操这种心,除非像 @abit @oflyhigh @tumutanzi 这样的大鱼。

Originally published at https://steemit.com Thank you for reading my post, feel free to Follow, Upvote, Reply, ReSteem (repost) @justyy which motivates me to create more quality posts.

原创 https://Steemit.com 首发。感谢阅读,如有可能,欢迎Follow, Upvote, Reply, ReSteem (repost) @justyy 激励我创作更多更好的内容。

// 稍候同步到我的中文博客英文博客

近期热贴 Recent Popular Posts

https://justyy.com/gif/steemit.gif


This page is synchronized from the post: The Best Upvoting Strategy Calculator in Javascript - 怎么样点赞收益最高? (新老用户都来看看)

如何使用Steem API/transfer-history和IFTTT同步到Slack消息? How to Use Steem API/transfer-history and IFTTT to sync to Slack?

This post, I show you how to use the Steem API/transfer-history and the IFTTT to sync the wallet activities to your Slack so you can get messages/updates pushed to your specific Slack channel.

上回的帖子里,我介绍了一API,但是很多人不清楚如何使用,或者说,到底能拿来干啥。今天我就介绍一个小应用。

我们公司用的内部聊天软件是SLACK,这玩意可以开放API给第三方,可以整合很多其它工具,特别是可以用IFTTT (If This Then That) 来连接其它的工具。

比如,我就想,如果别人给我帐号里送钱了,我想第一时间知道,而不是时不时的去刷 steemit.com 的钱包页面。我想这个消息能自动的推送到我公司用的聊天工具 Slack 上。

怎么用?很简单,首先你需要在你的机器(可以是服务器)上创建一个脚本,比如PHP脚本 (假设文件名为 check-transfer-history.php):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$id = 'justyy';
$tx = json_decode(file_get_contents("https://uploadbeta.com/api/steemit/transfer-history/?id=" . $id), true);
foreach ($tx as $r) {
$t = $r['time'];
$desc = $r['time_desc'];
$memo = $r['memo'];
$tx = $r['transaction'];
if (preg_match('/(\d)+\s+(second|minute|hour)s? ago/i', $desc, $matches)) {
if (
($matches[2] == 'second') ||
(($matches[2] == 'minute') && ($matches[1] == '1'))
) { // 这里只捕获2分钟内的消息 可以根据你的需求更改
$cmd = 'curl -s -X POST -H "Content-Type: application/json" -d \'{"value1":"'.$desc.'","value2":"'.$tx.'","value3":"'.$memo.'"}\' https://maker.ifttt.com/trigger/{steemit_transfer}/with/key/YOUR_APP_KEY';
echo $cmd;
shell_exec($cmd);
}
} else {
break;
}
}

这里需要替换的是第一行你的STEEM ID 和 你的 YOUR_APP_KEY, 这个值是 IFTTT 里的 Web Request 频道。 然后 接下来你需要 在 IFTTT里添加应用 Slack , 并且创建一个规则:

可以看到,我们可以传入3个值,那么就可以根据 steemit/transfer-history 提供的时间,事件和MEMO依次定制这些消息。

然后我们需要把上面那个PHP脚本 添加到 crontabcrontab -e 这里2分钟运行脚本进行检查,2分钟和上面PHP脚本里是对应的。

1
*/2 * * * * php /path/to/check-transfer-history.php

然后呢,我们试验一下, 我试着给我媳妇 @happyukgo 发了钱

然后 2分钟内就收到了推送:

Originally published at https://steemit.com Thank you for reading my post, feel free to Follow, Upvote, Reply, ReSteem (repost) @justyy which motivates me to create more quality posts.

原创 https://Steemit.com 首发。感谢阅读,如有可能,欢迎Follow, Upvote, Reply, ReSteem (repost) @justyy 激励我创作更多更好的内容。

// 稍候同步到我的中文博客英文博客

近期热贴 Recent Popular Posts

https://justyy.com/gif/steemit.gif


This page is synchronized from the post: 如何使用Steem API/transfer-history和IFTTT同步到Slack消息? How to Use Steem API/transfer-history and IFTTT to sync to Slack?

SteemIt API/transfer-history 最简单获取帐号钱包记录的API

SteemIt API/transfer-history is made available to public, free of charge, on four API servers world wide.

今天我又想做一个小功能需要查询STEEM用户的钱包历史,结果又发现官方的API示例不够简单。挺麻烦的,查了半小时后没有得到自己想要的,于是果断直接爪取SteemIt线上的网页。在这里先感谢 SteemIt.com 不阻止PHP直接抓取。

Let’s have a quick look on how to use this API
首先我们先来看看效果吧:

1
curl -X POST -d "id=justyy" https://uploadbeta.com/api/steemit/transfer-history/

It will soon returns a JSON-encoded string, with a first few lines that look like this:
很快的,就能返回一串JSON字符串,取前面几行,大概是这样的结构:

1
2
3
4
5
6
7
8
[{"time":"8\/14\/2017, 6:37:15 PM",
"time_desc":"1 hour ago",
"transaction":"Claim rewards: 8.203 SBD and 6.842 STEEM POWER",
"memo":""},
{"time":"8\/14\/2017, 6:00:12 PM",
"time_desc":"2 hours ago",
"transaction":"Claim rewards: 0.052 STEEM POWER",
"memo":""},... ...

And, here is how you use it in your production code.
怎么样,够好用吧,你直接可以用银河系里最好用的PHP语言这样来获取:

1
2
3
4
5
6
7
8
$id = 'justyy';
$tx = json_decode(file_get_contents("https://uploadbeta.com/api/steemit/transfer-history/?id=" . $id), true);
foreach ($tx as $r) {
echo $r['time'];
echo $r['time_desc'];
echo $r['memo'];
echo $r['transaction'];
}

SteemIt API/transfer-history 服务器

Like the API/steemit/account API, Four servers can also be chosen depending on your locations:
SteemIt API/account 一样,一共有4个API服务器已经正常运行很多年。

Using CloudFlare CDN Edge Server 使用缓存服务器来提速

You could also use CloudFlare CDN Edge servers to speed up the API requests by caching it on the edge servers, you need to use it like this:

1
/api/steemit/transfer-history/?cached&id=justyy

您需要使用 /api/steemit/transfer-history/?cached&id=justyy 的形式利用CloudFlare CDN节点来加速。

How it works? 原理

The following shows how easy it is to grab the page directly using phpQuery.
很简单,通过 phpQuery 抓取

1
compress.zlib://https://steemit.com/@$id/transfers

因为 steemit.com 返回是gzip 压缩的,所以需要指定 compress.zlib://

原代码如下: Full PHP Source Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$id = $_GET['id'] ?? (($_POST['id']) ?? '');
require_once('phpQuery.php');
function getTransfer($id) {
$doc = phpQuery::newDocumentFile("compress.zlib://https://steemit.com/@$id/transfers");
$arr = array();
foreach(pq('tr.Trans') as $p) {
$tx = array();
$x = pq($p);
$tx['time'] = $x->find('td:first>span')->attr('title');
$tx['time_desc'] = trim(strip_tags($x->find('td:first')->html()));
$tx['transaction'] = trim(strip_tags($x->find('td:eq(1)')->html()));
$tx['memo'] = trim(strip_tags($x->find('td:eq(2)')->html()));
$arr[] = $tx;
}
return $arr;
}
$data = getTransfer($id);
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
die(json_encode($data));

I’ll show you some simple applications tomorrow of using these APIs.
就这样,接下来明天我会写些小程序,让你们瞧瞧,这样的调用方式是多么的方便和快捷!

如何使用Steem API/transfer-history和IFTTT同步到Slack消息? How to Use Steem API/transfer-history and IFTTT to sync to Slack?

Originally published at https://steemit.com Thank you for reading my post, feel free to FOLLOW and Upvote @justyy which motivates me to create more quality posts.

原创首发于 https://steemit.com 非常感谢阅读, 欢迎FOLLOW和Upvote @justyy 能激励我创作更多更好的内容.

// 稍候同步到我的中文博客英文博客

近期热贴 Recent Popular Posts

https://justyy.com/gif/steemit.gif


This page is synchronized from the post: SteemIt API/transfer-history 最简单获取帐号钱包记录的API

第一次打肿脸充胖子 - 花了200STEEM租1万SP四周!

@minnowbooster 提供租贷SP的服务,于是我第一次花了200 STEEM租了1万SP, 为期是4周。

1
2
3
14 hours ago	Receive 0.001 SBD from minnowbooster	Your delegation request for 4 weeks 10000.0 SP was filled by @bayrene.
3 days ago Receive 0.001 SBD from minnowbooster Your delegation request for 4 weeks 10000.0 SP is in the process of being filled. If it can not be filled within 3 days, it will be returned to you.
3 days ago Transfer 200.000 STEEM to minnowbooster 4

有啥好处?直接的好处就是可以很装B的宣传一下, 假装自己是大户。

200个STEEM分到每天的费用就是7.14 STEEM, 1万SP全开100%点赞是 1.5美元左右:

https://justyy.com/wp-content/uploads/2017/08/10k-sp-how-much-per-vote.jpg

但是据说, 租来的SP点赞收益不属于你,也就是说你得把收益再乘于0.75 = 1.125 美元。
一天得点8下才能回本?而且还得按100%的点,考虑到点一次能量损失2%,每36分钟回0.5%,很难人工操作才能回本。每2小时点一次,点8次。

第一次打肿脸充胖子

算了,联系官方,也好像没法退款,就这么着吧。反正 200 STEEM可以让我 打肿脸充胖子,4周,而且我也没有花真金白银去买STEEM,我还不算老,输得起。

除了帖子收益的好处,另外就是你可以自己顶自己的评论,这样的话,收益高的评论就有置顶的功效,这个很不错!

我也是过万户啦!请好好享受你的 steemit 写作!

Originally published at https://steemit.com Thank you for reading my post, feel free to FOLLOW and Upvote @justyy which motivates me to create more quality posts.

原创首发于 https://steemit.com 非常感谢阅读, 欢迎FOLLOW和Upvote @justyy 能激励我创作更多更好的内容.

// 稍候同步到我的中文博客英文博客

近期热贴 Recent Popular Posts


This page is synchronized from the post: 第一次打肿脸充胖子 - 花了200STEEM租1万SP四周!

API steemit/account 简单封装了一下 steemit/account 的 API


I have simply wrapped the code from 第一次使用STEEMSQL查询谷哥点名数据


onto four servers, located at East USA, West USA, Tokyo Japan and London, UK.


This simplifies the API call if you want to retrieve account information, for example, using PHP, you can retrieve that with just two lines of code.


$account = json_decode(file_get_contents(“https://uploadbeta.com/api/steemit/account/?id=justyy“), true);


echo $account[0][‘voting_power’]; // e.g. returns 9002


Cloudflare CDN Edge servers are also available if you invoke the API endpoint via GET method and provides a ?cached parameter i.e.


https://uploadbeta.com/api/steemit/account/?cached&id=justyy


Thanks @oflyhigh  !


前几天看了O哥的大作  第一次使用STEEMSQL查询谷哥点名数据


觉得PHP如此的强大,不愧为星球上最好的编程语言。几行代码就可以把官方提供的API给用了起来。但是在使用的时候还是得引入一些代码,并且有一些参数对于初学者来说比较难懂。


我今天其实想做一个小功能的,突然就想到,如果只是想根据STEEM ID来得到一些帐户的基本信息,能简单一点是一点。于是在O哥的代码上简单封装了一下API,并且提供4个服务器供世界各地的爱好者使用。


我的四个服务器位于:日本东京,英国伦敦,美国西部还有一个美国东部,我长年(好几年)自己花钱租VPS主机,提供免费的API使用,并且用了付费的  Cloudflare CDN 用于保证服务器的安全和稳定,所以尽可以放心用在你的项目上。


这四个API服务器调用是:



API  steemit/account 的使用方法


怎么用呢?很简单:你可以直接在浏览器里打开 (以GET的方式):


https://uploadbeta.com/api/steemit/account/?id=justyy


返回JSON数据。或者你可以通过POST方式,比如这样:


curl -X POST -d “id=justyy” https://uploadbeta.com/api/steemit/account/


返回:



这里还需要指出的是,如果你想获取速度快(比如上面4个服务器都离你太远了 比如澳洲),而你又不是那么需要实时更新的速度,这时候可以用上CloudFlare 的CDN服务器,只要在调用的时候使用:


https://uploadbeta.com/api/steemit/account/?cached&id=justyy


这样调用 API的结果会1小时更新1次,结果缓存于CloudFlare CDN的Edge结点。


弄了这么多,你在PHP里只需要这样两行就可以了:


$account = json_decode(file_get_contents(“https://uploadbeta.com/api/steemit/account/?id=justyy“), true);


echo $account[0][‘voting_power’]; // 获取能量 如 9002


再次感谢 @oflyhigh  我这是站在巨人的肩膀上!



 Originally published at https://steemit.com Thank you for reading my post, feel free to FOLLOW and Upvote @justyy which motivates me to create more quality posts.


原创首发于 https://steemit.com 非常感谢阅读, 欢迎FOLLOW和Upvote @justyy  能激励我创作更多更好的内容.   


 // 稍候同步到我的中文博客英文博客。  



 近期热贴 Recent Popular Posts 




This page is synchronized from the post: API steemit/account 简单封装了一下 steemit/account 的 API

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×