root

how can I run a perl script which needs root?

冷暖自知 提交于 2020-01-05 07:59:05
问题 I need to execute a perl script located in /root/scripts/ from php using ssh from another computer or from the same computer. The thing is that I just don't know how to make php log into roots account to excecute only that file. As user$ I can't access /root/scripts/, so I can't call it using excec or system. I have tried using ssh to log into sudo su, and when I give my password it hangs. I leave the code here: <?php include('Net/SSH2.php'); $ssh = new Net_SSH2('IP'); if (!$ssh->login('user'

How I can hide the root element in a dendogram d3

*爱你&永不变心* 提交于 2020-01-05 07:43:18
问题 I have the following code var m = [20, this.settings.get("margin_right"), 20, this.settings.get("margin_left")], w = width - m[1] - m[3], h = height - m[0] - m[2], i = 0; var tree = d3.layout.tree() .size([h, w]); var diagonal = d3.svg.diagonal() .projection(function(d) { return [d.y, d.x]; }); var vis = d3.select(this.el).append("svg:svg") .attr("width", w + m[1] + m[3]) .attr("height", h + m[0] + m[2]) .append("svg:g") .attr("transform", "translate(" + m[3] + "," + m[0] + ")"); data.x0 = h

help with secant root finding C++

安稳与你 提交于 2020-01-05 07:33:27
问题 Can someone explain to me how I would use the secant method to find the root of an equation? The equation is: ( v / b ) ^2sin(alpha)= kr * Ts^4 +Uc *Ts -q and I have to find Ts . I have all the other info but am confused on what I'm supposed to do with the seccant method. Any help would be greatly appreciated. Here is my code so far: #include <iostream> #include <cmath> #include <fstream> #include <iomanip> #include <cmath> using namespace std; void secant(double, double, double, double,

help with secant root finding C++

一个人想着一个人 提交于 2020-01-05 07:32:50
问题 Can someone explain to me how I would use the secant method to find the root of an equation? The equation is: ( v / b ) ^2sin(alpha)= kr * Ts^4 +Uc *Ts -q and I have to find Ts . I have all the other info but am confused on what I'm supposed to do with the seccant method. Any help would be greatly appreciated. Here is my code so far: #include <iostream> #include <cmath> #include <fstream> #include <iomanip> #include <cmath> using namespace std; void secant(double, double, double, double,

MySQL提示Access denied for user ''@'localhost'”的解决

故事扮演 提交于 2020-01-05 04:34:49
记得那时由于没有网络,把rootpassword改错了写成了: update user set password="122" where user="root"; 之后mysql就開始不工作了。 #mysql -u root -p #123 就会出现:ERROR 1045 (28000): Access denied for user ''@'localhost' (using password: NO) 仅仅能这样: #mysql -u root mysql> use mysql 又出现了ERROR 1045 (28000): Access denied for user ''@'localhost' (using password: NO) 找了好久资料: 解决方法: 1.关闭mysql # service mysqld stop 2.屏蔽权限 # mysqld_safe --skip-grant-table 屏幕出现: Starting demo from ..... 3.新开起一个终端输入 # mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; mysql> FLUSH PRIVILEGES;//记得要这句话,否则假设关闭先前的终端

HDU 4325 线段树离散化

谁都会走 提交于 2020-01-05 03:07:14
线段树离散化 1.输入完所有数据,对开花时间离散化 2.区间更新,点查询,LAZY操作。。 View Code #include<stdio.h> #include<stdlib.h> #include<string.h> #include<iostream> #include<vector> using namespace std; #define MAXN 51000 struct node { int left, right; int num; int sum; int lazy; }seg[500010]; int N, M; struct flower { int a,b; }p[101000]; int v[200010]; int hashx[201000]; void build(int l, int r, int root) { int mid = (l + r) / 2; seg[root].left = l; seg[root].right = r; seg[root].num = 0; seg[root].lazy = 0; seg[root].sum = 0; if( l == r ) { return; } build(l,mid,root*2); build(mid+1,r,root*2+1); seg[root].sum = seg[root*2]

各种骚操作线段树

你说的曾经没有我的故事 提交于 2020-01-05 03:06:48
线段树是世界上最美的数据结构(主要记录一些有意义的线段树.....特别是骚操作 1.uestc1425 Another LCIS http://acm.uestc.edu.cn/#/problem/show/360 题意:两种操作 对于一段区间的数加上c 查询最长连续上升序列 题解:彻底弄清楚区间更新lazy的含义 就是切水题 直接区间更新然后区间合并用点小技巧即可 #include <iostream> #include <algorithm> #include <cstdio> #define N 100005 using namespace std; typedef struct node{ int l;int r;int l1;int len1;int r1;int len2; int len;int flag; }node; node d[N<<2]; int a[N]; void up(int root){ d[root].l1=d[root<<1].l1;d[root].r1=d[root<<1|1].r1; if(d[root<<1].r1<d[root<<1|1].l1){ d[root].len=max(d[root<<1].len,max(d[root<<1].len2+d[root<<1|1].len1,d[root<<1|1].len)); if(d

CentOS 6忘记密码解决办法,root和普通用户均可

可紊 提交于 2020-01-05 01:39:34
转自 nui111 的文章:http://blog.csdn.net/nui111/article/details/28007357 说明 操作系统:CentOS 6.0 遇到问题:忘记管理员账号root的密码,进不了系统 解决办法:重置root密码为123456 操作: 开机启动系统,在进入系统之前按键盘上面的Esc键,会进入下面的界面 按键盘上的e键,出现下面界面 用键盘上的方向键移动光标到第二项,然后再按键盘上面的e,会出现下面的界面 输入一个空格键,然后在输入数字1,回车之后,会出现下面的界面 这个时候光标还是定位在第二项,继续按键盘上面的b键,系统会自动重启,进入下面的界面 现在重置root密码 输入passwd root,回车 要求输入新密码,这里输入123456 回车 再次输入123456 回车 看到passwd:all authentication tokens updated successfully.一行 说明密码修改成功 现在重启系统,输入shutdown -r now 回车 系统自动重启之后,输入root回车,再输入密码123456,系统登录成功。 普通用户忘记密码 1.使用root用户登录系统,找到/etc/shadow文件。 2.找到用户名开头的那一行,例如我的用户名为pds,,以冒号为分割符,红色部分是密码加密部分 pds:$1$CivopRgF

怎么恢复NetScaler配置

雨燕双飞 提交于 2020-01-05 00:11:42
由于误删或者误配置我们需要恢复NetScaler之前的配置应该怎么办? 首先我们要知道NetScaler的配置文件存放在/flash/nsconfig 这个目录下面(shell模式) # ls-l -rw-r--r-- 1 root wheel 13867 Dec 9 16:38 ns.conf -rw------- 1 root wheel 12720 Dec 9 16:38 ns.conf.0 -rw------- 1 root wheel 11908 Dec 9 16:26 ns.conf.1 -rw------- 1 root wheel 124465 Dec 9 15:20 ns.conf.2 -rw------- 1 root wheel 123148 Dec 9 14:11 ns.conf.3 -rw------- 1 root wheel 124465 Jul 29 10:26 ns.conf.4 NetScaler 会保存最近的5份配置在/flash/nsconfig 文件夹下面,其中ns.conf是最新保存的配置文件。这个也就相当于Cisco中的startup configuration保存在flash中。 当NetScaler重新启动的时候,会自动加载ns.conf这个文件为系统的running-config 所以我们想恢复之前的配置的话,可以将文件ns

python中的os.walk

[亡魂溺海] 提交于 2020-01-04 16:44:48
原文出处:https://www.jianshu.com/p/bbad16822eab python中os.walk是一个简单易用的文件、目录遍历器,可以帮助我们高效的处理文件、目录方面的事情。 1.载入 要使用os.walk,首先要载入该函数 可以使用以下两种方法 import os from os import walk 2.使用 os.walk的函数声明为: walk(top, topdown=True, onerror=None, followlinks=False) 参数 top 是你所要便利的目录的地址 topdown 为真,则优先遍历top目录,否则优先遍历top的子目录(默认为开启) onerror 需要一个 callable 对象,当walk需要异常时,会调用 followlinks 如果为真,则会遍历目录下的快捷方式(linux 下是 symbolic link)实际所指的目录(默认关闭) os.walk 的返回值是一个生成器(generator),也就是说我们需要不断的遍历它,来获得所有的内容。 每次遍历的对象都是返回的是一个三元组(root,dirs,files) root 所指的是当前正在遍历的这个文件夹的本身的地址 dirs 是一个 list ,内容是该文件夹中所有的目录的名字(不包括子目录) files 同样是 list , 内容是该文件夹中所有的文件