- 博客(26)
- 收藏
- 关注
原创 正则表达式批量重命名
rename 's/\d+/sprintf("%04d", $&)/e' *.jpg可以批量把p1.jpeg p2.jpeg ... p100.jpeg ...重命名为p0001.jpeg p0002.jpeg ... p0100.jpeg ...如果在命令前加入-nrename -n 's/\d+/sprintf("%04d", $&)/e' *.jpg...
2017-07-26 10:35:00 569
原创 Ubunu12.04 vncserver xstartup配置文件
以下有效:#!/bin/sh# Uncomment the following two lines for normal desktop:unset SESSION_MANAGER#exec /etc/X11/xinit/xinitrcgnome-session --session=gnome-classic &[ -x /etc/vnc/xstartup ] &a...
2017-07-21 12:20:00 137
原创 多维数组与指针(一)
#include <stdio.h>int main(){ const int foo[3][4] = { {11,12,13,14}, {21,22,23,24}, {31,32,33,34}, }; ...
2017-07-17 22:31:00 64
原创 指针使用const修饰总结
1double rates[5] = {1, 2, 3, 4, 5};const double * pd = rates;被pd指向的值不可改变,比如,不允许*pd = 20但是pd的指向改变,比如,允许pd++2double rates[5] = {1, 2, 3, 4, 5};const double * const pc = rates;此时pd的指向也不...
2017-07-17 22:07:00 77
原创 gcc开启C99或C11标准支持
开启C99支持gcc -std=c99 forc99.c开启C11支持gcc -std=c1x forc11.c或gcc -std=c11 forc11.c
2017-07-17 21:20:00 1384
原创 数组作为参数的四种声明方式
int sum (int *arg, int n);int sum*int *, int);int sum(int ar[], int n);int sum(int [], int);
2017-07-17 19:43:00 872
原创 IntelliJ IDEA 代码调式
Mute Breakpoints: 保留所有断点,但是不执行(程序一次性执行)。Condition: 条件触发即当执行到i的值变为5的时候,在断点处暂停。
2017-07-07 17:36:00 130
原创 Ubuntu下使用天河注意事项
把下载的.cgi登陆文件用文本编辑器打开,修改端口用管理员权限打开.cgi才能绑定端口$ gksu nautilus # browse files as root$ gksu gedit /etc/fstab # edit file as root使用ssh命令登陆账号的时候,也要添加-p <NEW-PORN-NUMBER>,否...
2017-07-06 11:00:00 69
原创 Python"sorted()"和".sort()"的区别
sorted(A-LIST)会返回一个新的object,不改变A-LIST*本身。A-LIST.sort()会直接改变A-List,不产生新的object**。
2017-07-05 15:31:00 73
原创 pandas.DataFrame.sample
DataFrame.sample(n=None, frac=None, replace=False, weights=None, random_state=None, axis=None)[source]n : int, optionalNumber of items from axis to return. Cannot be used with frac. Default = ...
2017-07-05 12:15:00 78
原创 Python格式输出汇总
print ('%10s'%('test'))print ('{:<10}'.format('test'))#left-alignedprint ('{:>10}'.format('test'))#left-alignedprint ('{:10}'.format('test'))# defaut(right-aligned)print ('{:_<10}'.f...
2017-07-04 11:33:00 204
原创 Ubuntu12.04安装配置vncserver
安装sudo apt-get install vnc4server修改配置文件sudo vim ~/.vnc/xstartup#!/bin/sh# Uncomment the following two lines for normal desktop:unset SESSION_MANAGERunset DBUS_SESSION_BUS_ADDRESS# exec...
2017-07-03 21:12:00 64
原创 Ubuntu12.04安装配置x11vnc
全程在root下进行安装x11vncsudo apt-get install vino vinagre x11vnc 设置密码sudo x11vnc -storepasswd sudo x11vnc -storepasswd in /etc/x11vnc.pass sudo cp /root/.vnc/passwd /etc/x11vnc.pass配置开机自启动...
2017-07-03 17:48:00 90 1
原创 Python的list中的选取范围
a = [1,2,3,4,5,6,7,8,9,10]a[0:1] = [1]a[0:2] = [1,2]包含开头,不包含结尾。a [:-1]: 从头一直到最后一个元素a[-1],但不包含最后一个元素。Python这样做的原因是:word[:2] # 取前两个word[2:] # 除了前两个,其他全部选取...
2017-07-02 22:37:00 888
原创 Python中使用"subplot"在一张画布上显示多张图
subplot(arg1, arg2, arg3)arg1: 在垂直方向同时画几张图arg2: 在水平方向同时画几张图arg3: 当前命令修改的是第几张图t = np.arange(0,5,0.1)y1 = np.sin(2*np.pi*t)y2 = np.sin(2*np.pi*t)plt.subplot(211)plt.plot(t,y1,'b-.')plt.sub...
2017-07-02 20:10:00 1652
原创 pylab和pyplot的区别
Pylab combines the functionality of pyplot with the capabilities of NumPy in a single namespace, and therefore you do not need to import NumPy separately. Furthermore, if you import pylab, pyplo...
2017-07-02 17:45:00 279
原创 一张图理解"Figure", "Axes", "Axis"
Figure is the object with the highest level in the hierarchy. It corresponds to the entire graphical representation and generally can contain many Axes.Axes is generally what you mean as plot ...
2017-07-02 17:40:00 124
原创 Python的"random"函数的使用(一)
random.randrange(1,10)随机产生0~7之间的整数,不包含7。random.sample(range(100), 5)随机从range(100)中产生5个数,放入一个list。random.choice()possiblePets = ['Cat', 'Dog', 'Fish']print(random.choice(possiblePets))从pos...
2017-07-02 15:16:00 92
原创 "sorted()"中的"Key Functions"
Pythonsorted()函数中可以加入key=<FUNCTION>参数。作用是每个元素在排序之前,先作为key=<FUNCTION>中FUNCTION的参数,用FUNCTION的输出结果作为依据来排序。print (sorted("This is a test string from Dufresne".split(), key = str.lower))...
2017-07-02 14:48:00 127
原创 tuple unpacking
拆开Tuplelax_coordinates = (33.9425, -118.408056)latitude, longitude = lax_coordinates # tuple unpacking交换位置variable = (10,20) # a = 10, b = 20b,a = variableprint ("a = %d, b = %d" % (a,b))...
2017-07-01 21:14:00 105
原创 理解"__repr__"
class aTest: def __repr__(self): return "This is an aTest class."a = aTest()print (a)class bTest: passb = bTest()print(b)输出结果:This is an aTest class.<__main__.bTes...
2017-07-01 18:36:00 56
原创 Python中的"Special Method"
The first thing to know about special methods is that they are meant to be called by the Python interpreter, and not by you. You don’t write my_object.len(). You write len(my_object) and, if my...
2017-07-01 18:25:00 95
原创 abstractmethod
a class with an abstract method cannot be instantiated (that is, we cannot create an instance by calling it) unless all of its abstract methods have been defined in subclasses. Although this req...
2017-07-01 12:27:00 88
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人