-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php对称加密 #105
Comments
Mysql 获取成绩排序后的名次
select id,maxScore,(@rowNum:=@rowNum+1) as rowNo
from t_user,
(select (@rowNum :=0) ) b
order by t_user.maxScore desc
查出某个用户在所有用户成绩中的排名
select u.rowNo from (
select id,(@rowNum:=@rowNum+1) as rowNo
from t_user,
(select (@rowNum :=0) ) b
order by t_user.maxScore desc ) u where u.id="2015091810371700001";
http://www.qttc.net/201302281.html http://www.cnblogs.com/zengguowang/p/5541431.html
SELECT obj.user_id,obj.score,@rownum := @rownum + 1 AS rownum FROM (SELECT user_id,score FROM `sql_rank` ORDER BY score DESC) AS obj,(SELECT @rownum := 0) r ;
SELECT @counter:=@counter+1 AS rownum,user_id,score FROM sql_rank,(SELECT @counter:=0) AS t ORDER BY score desc;
SELECT obj.user_id,obj.rownum from (select user_id,(@rownum := @rownum + 1) AS rownum from sql_rank,(select (@rowNum :=0)) b ORDER BY sql_rank.score DESC) obj where obj.user_id=103;
SELECT * FROM (
SELECT (@rownum:=@rownum+1) AS rownum, a.* FROM `test` a, (SELECT @rownum:= 0 ) r ORDER BY a.`socre` DESC ,`createTime`
) AS b WHERE id = 1
select invite_id,rownum from (select id,(@rownum := @rownum + 1) AS rownum,invite_id,count(if(be_invited_id=0,null,1)) as s from webinar_invites,(select (@rowNum :=0)) b where webinar_id=463992667 group by invite_id having s>0 order by s desc ,id asc) as i where i.invite_id=1027156;
获取单个用户的成绩在所有用户成绩中的排名
SET @counter=0;
SELECT @counter:=@counter+1 AS Rank,LastName,Roll_no as Roll FROM Students ORDER BY Roll_no ASC;
SELECT @counter:=@counter+1 AS Rank,LastName,Roll_no as Roll FROM Students,(SELECT @counter:=0) AS t ORDER BY Roll_no ASC;
不用临时变量, 用表的自关联
SELECT
(SELECT COUNT(ROLL_NO) FROM Students WHERE s.ROLL_NO <= ROLL_NO) AS Rank,
s.LastName, s.Roll_no AS Roll
FROM Students s
ORDER BY s.Roll_no ASC
添加公钥
生成密钥对,添加公钥到受信任的密钥中,并保留私钥。
$ ssh-keygen
(一路回车,将在 ~/.ssh/ 下生成 id_rsa 和 id_rsa.pub 两个文件,分别为私钥和公钥。)
$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys
复制私钥并妥善保存到自己的电脑上。
禁止通过密码登录
$ vi /etc/ssh/sshd_config
# 查找并修改下面两项
PasswordAuthentication no // 禁止使用基于口令认证的方式登陆
PubkeyAuthentication yes // 允许使用基于密钥认证的方式登陆
在执行下面命令之前,确保私钥已经保存到自己的电脑(自己的 Windows / Linux / MacOS 电脑, 而不是 VPS),否则重启 sshd 服务后,将无法通过密码再连接到 VPS,而只能用私钥连接。
$ systemctl restart sshd
# 重启 sshd 服务
假如保存下来的私钥文件名为 id_rsa.vultr,那后面要通过 SSH 连接 VPS 时,执行下面命令 即可。
$ ssh -i id_rsa.vultr root@112.113.114.115
将 112.113.114.115 替换为你的 VPS 公网 IP
Vultr的vps搭建shadowsocks翻墙http://mpc2008cn.github.io/2015/10/22/vps/ |
在 Vultr 上搭建 Shadowsocks 服务端https://tenach.github.io/post/ss-server-on-vultr/ $vipMinId = UserVip::min('id');
$vipMaxId = UserVip::max('id');
$index = 0;
$take = 5000;
for ($i=$vipMinId;$i<=$vipMaxId;$i+=$take) {
$userIsPayed = [];
$skip = $take * $index;
$userVipList = UserVip::skip($skip)->take($take)->lists('user_id','id');
if (empty($userVipList)) continue;
if (!empty($userIsPayed)) {
UserVip::whereIn('id', $userIsPayed)->update(['is_payed' => 1]);
}
$index += 1;
}
$userVipCount = UserVipModel::where('is_payed', 0)->count();
$take = 10000;
$s = floor($userVipCount/$take);
for ($i=0; $i<=$s; $i++) {
$skip = $take*$i;//每页10000
$userVips = UserVipModel::where('is_payed', 0)->skip($skip)->take($take)->orderBy('id')->get();
//调用脚本
$beginTime = strtotime('2017-09-01');
$endTime = strtotime('2017-10-24');
do {
$this->call('UserInitiatorStatistics', [
'timeline' => date('Y-m-d', $beginTime)
]);
$this->info(date('Y-m-d', $beginTime));
$beginTime += 86400;
} while ($beginTime <= $endTime);
$timeline = $this->argument('timeline');
$str='请输入你的php代码';
echo (strlen($str) + mb_strlen($str, 'utf8')) / 2;//中英文混合中文按2个字符计算
mb_strimwidth($l['subject'], 0, 30, '...', 'utf-8');
mb_strwidth(trim($subject), 'utf-8') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: