博文

ubuntu install remarkable

wget https://remarkableapp.github.io/files/remarkable_1.62_all.deb sudo dpkg -i remarkable_1.62_all.deb  sudo apt-get upgrade -f

python 阶乘

def fact(n): if n<= 1 : return 1 else : return n*fact(n- 1 ) print fact( 8 )

python 学习

# -*- coding: utf-8 -*- import math import matplotlib.pyplot as plt if __name__=="__main__":     x=[float(i)/100 for i in range(1,300)]     y=[math.log(i) for i in x]     plt.plot(x,y,'r-',linewidth=3,label='log Curve')     a=[x[20],x[175]]     b=[y[20],y[175]]     plt.plot(a,b,'g-',linewidth=2)     plt.plot(a,b,'b+',markersize=15,alpha=0.75)     plt.legend(loc='upper left') #左上角     plt.xlabel('x')     plt.ylabel('log(x)')     plt.show

生日悖论

dupli <- function(result){   for (i in 1:length(result)){     if (duplicated(result)[i]==T){       return(1)       break()     }   } } sampl <- function(N){   Num <-0   for(j in 1:N){     set.seed(j)     result <- sample(1:365,50,replace = T)     Num <- sum(Num,dupli(result),na.rm = T)     if (j==N){       return(Num)     }   } } sampl(1000)/1000

python 学习(一)

# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import random def rand7():     return random.randint(1,7)         def rand10():     result=0     while True:         a1=rand7()-1         a2=rand7()-1         r=a1*7+a2         if r<40:             result=r/4+1             break     return result print rand10()  

python 2.7 中文编码

import之前添加 #encoding:utf-8 或 # -*- coding: utf-8 -*-

Google Drive 同步工具(grive)安装

sudo add-apt-repository ppa:nilarimogard/webupd8 sudo add-apt-repository ppa:thefanclub/grive-tools sudo apt-get update sudo apt-get install grive grive-tools search grive setup