自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

BishopTylaor的博客

工作学习记录本

  • 博客(51)
  • 收藏
  • 关注

原创 mysql常用语句(补充中)

1. 登录数据库本地:mysql -u root -p远程:mysql -h[远程公网IP地址] -u [mysql用户名] -p [mysql密码];2. 备份2.1 备份mysql数据库mysqldump -h[远程公网IP地址] -u[mysql用户名] -p[mysql密码] [数据库名] > [数据库文件名.sql];2.2 备份my...

2018-04-08 11:44:51 140

原创 通过pip安装pytorch超时问题解决

前言这篇文章只记录通过pip安装pytorch超时问题的解决方案。默认阅读者已经安装了Python2.7或者其他3.x的版本版本信息系统:macos-11.1pip:21.0.1python:3.8解决方案第一步:去官网查询合适的版本和命令第二步:>pip install torch torchvision torchaudioCollecting torch Downloading torch-1.7.1-cp38-none-macosx_10_9_x86_64.w

2021-02-22 10:42:40 2748 3

原创 Python 文件相关操作

内置函数文件读取通常我们在读取文件的时候,会用到read(), readline(), readlines()。read ()的方法是一次性把文件的内容以字符串的方式读到内存, 放到一个字符串变量中readlines()的方法是一次性读取所有内容, 并按行生成一个list因为read()和readlines()是一次性把文件加载到内存, 如果文件较大, 甚至比内存的大小还大, 内存就会爆...

2019-01-28 18:20:38 205

原创 python 判断字符串相似度

方法1import difflibdef get_equal_rate(str1, str2): return difflib.SequenceMatcher(None, str1, str2).quick_ratio()方法2import Levenshteindef get_equal_rate(str1, str2): return Levenshtein.ratio...

2019-01-19 15:27:16 14133 4

原创 python中去掉字符串中的\xa0、\t、\n等字符

\xa0是不间断空白符  我们通常所用的空格是 \x20,是在标准ASCII可见字符 0x20~0x7e 范围内。而 \xa0属于 latin1 (ISO/IEC_8859-1)中的扩展字符集字符,代表空白符nbsp(non-breaking space)。latin1 字符集向下兼容 ASCII ( 0x20~0x7e )。inputstring = u'\n ...

2019-01-19 15:08:28 6958

原创 LeetCode.206.Reverse Linked List

原题链接:Reverse Linked List题目内容: Reverse a singly linked list.Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL

2018-09-06 17:50:10 112

原创 LeetCode.19.Remove Nth Node From End of List

原题链接:Remove Nth Node From End of List题目内容: Given a linked list, remove the n-th node from the end of list and return its head.Example: Given linked list: 1->2->3->4->5, and n = 2....

2018-08-29 16:54:26 103

原创 阿里云主机CENTOS设置虚拟内存(交换分区)

1.添加swap文件大小为2G默认情况下, of=/swapfile 即swapfile文件创建在/var/目录下。 若我在创建在/opt/image/目录下, 则下面所有的操作里有/swapfile的都要改为/opt/image/swap# dd if=/dev/zero of=/swapfile bs=1k count=20480002.创建SWAP文件# mkswap ...

2018-08-07 16:19:22 668

原创 JQuery 特殊字符转义(Uncaught Error: Syntax error, unrecognized expression:的处理)

一般情况下,在jQuery选择器中,我们很少会用到诸如“.”、“#”、“(”、“[”等特殊字符,因为根据W3C规定,HTML文档中属性的值是不能包含有这些个特殊字符的,但是在实际应用中,偶尔也会遇到表达式中含有“#”和“.”等特殊字符。这时候需要对这些字符进行转义option.replace(/\//, '\\\/').replace(/\s/g, "-").replace("(", "\...

2018-08-07 16:14:24 33496

原创 CENTOS 7 TENSORFLOW 安装

1、centos 系统库更新yum -y update2、centos安装系统依赖库yum install -y libxslt-devel.x86_64 libX11-devel pcre-devel zlib-devel.x86_64 libxml2 gettext.x86_64 freetype-devel vim ant libffi tcl leptonica cur...

2018-07-24 10:27:22 629

原创 LeetCode.88.Merge Sorted Array

原题链接:Merge Sorted Array题目内容: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n r...

2018-05-07 17:51:00 128

原创 MongoDB.oplog相关浅析

1. oplog里面有啥        MongoDB 的Replication是通过一个日志来存储写操作的,这个日志就叫做oplog。 在默认情况下,oplog分配的是5%的空闲磁盘空间。通常而言,这是一种合理的设置。可以通过mongod --oplogSize来改变oplog的日志大小。 oplog是cap...

2018-04-20 11:03:19 2202

原创 Python.Sqlalchemy.使用OEM相关语句

新增数据user = User(name='a')session.add(user)user = User(name='b')session.add(user)user = User(name='a')session.add(user)user = User()session.add(user)session.commit()使用User表相关操作from sq...

2018-04-18 18:25:49 237

原创 MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk

今天运行Redis时发生错误,错误信息如下: (error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Red...

2018-04-16 19:15:47 188

原创 Python文件下载总结

1. Requests模块import requests print "download with requests"url = 'https://linux.linuxidc.com/linuxconf/download.php?file=Li9saW51eGZpbGVzL0xpbnV4JUI5JUFCJUM5JUU3LnBuZw==' r = requests.get(url) ...

2018-04-16 14:54:44 180

原创 正则表达式基础总结.断言

1. 正则基础 元字符 描述 \ 将下一个字符标记符、或一个向后引用、或一个八进制转义符。例如,“\\n”匹配\n。“\n”匹配换行符。序列“\\”匹配“\”而“\(”则匹配“(”。即相当于多种编程语言中都有的“转义字符”的概念。 ^ 匹配输入字符串的开始位置。如果设置了RegExp对象的Multiline属性,^...

2018-04-11 11:36:39 2435

原创 jQuery - 获得内容和属性

获得内容 - text()、html() 以及 val() 三个简单实用的用于 DOM 操作的 jQuery 方法: ● text() - 设置或返回所选元素的文本内容 ● html() - 设置或返回所选元素的内容(包括 HTML 标记) ● val() - 设置或返回表单字段的值$("#btn1").click(function(){ alert("Text: ...

2018-04-11 09:52:42 323

原创 LeetCode.8.String to Integer (atoi)

原题链接:String to Integer (atoi)题目内容: Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask your...

2018-04-10 16:45:05 98

原创 LeetCode.7.Reverse Integer

原题链接:Reverse Integer题目内容: Given a 32-bit signed integer, reverse digits of an integer.Example 1: Input: 123 Output: 321Example 2: Input: -123 Output: -321Example 3: Input:...

2018-04-10 15:04:19 138

原创 Python.json.常见两个错误处理(Expecting , delimiter)(Invalid control character at)

ValueError: Invalid control character at: line 1 column 122(char 123)出现错误的原因是字符串中包含了回车符(\r)或者换行符(\n) 解决方案:转义json_data = json_data.replace('\r', '\\r').replace('\n', '\\n')使用关键字strict...

2018-04-09 16:49:23 43517 2

转载 vim指令详解

转载自https://blog.csdn.net/xiajun07061225/article/details/7039413一、我们为什么要学习vim编辑器?Linux的命令行界面下面有非常多的文本编辑器。比如经常听说的就有Emacs、pico、nano、joe与vim等。vim可以看做是vi的高级版。我们为什么一定要学习vim呢?有以下几个原因:(1)所有的Unix like系统都...

2018-04-09 13:56:34 223

原创 LeetCode.28.Implement strStr()

原题链接:Implement strStr()题目内容: Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1: Input: haystack = “hello”, needle = “ll” Out...

2018-04-08 19:26:53 109

原创 LeetCode.14.Longest Common Prefix

原题链接:Longest Common Prefix题目内容: Write a function to find the longest common prefix string amongst an array of strings.找到字符列表中的最长前缀,注意[], [“”], [“a”, “a”]这样的例子Pythonclass Solution(object):...

2018-04-07 18:32:48 91

原创 Linux常用命令

最近入手了阿里云服务器,遂将常用的Linux命令稍微总结一下,方便查阅目录操作 命令 操作 cd .. 回到上一级目录 cd /home 进入 ‘/home’ 目录 cd ../.. 返回上两级目录 cd - 返回上次所在目录 ls 查看目录中的文件 ls –a 显示隐藏文件 ls –l ...

2018-04-04 18:33:22 137

原创 LeetCode.38.Count and Say

原题链接:Count and Say题目内容: The count-and-say sequence is the sequence of integers with the first five terms as following: 1 11 21 1211 111221 1 is read off as “one 1” or 11. 11 i...

2018-03-30 19:33:27 96

原创 LeetCode.125.Valid Palindrome

原题链接:Valid Palindrome 题目内容: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a pa...

2018-03-30 19:03:15 105

原创 LeetCode.242.Valid Anagram

原题链接:Valid Anagram题目内容: Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return fa...

2018-03-28 19:09:41 112

原创 LeetCode.387.First Unique Character in a String

原题链接:First Unique Character in a String题目内容: Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples: s = “leetcode” re...

2018-03-28 18:07:30 102

原创 LeetCode.344.Reverse String

原题链接:Reverse String题目内容: Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.Pythonclass Solution(object): def...

2018-03-28 16:44:56 104

原创 LeetCode.326.Power of Three

原题链接:Power of Three题目内容: Given an integer, write a function to determine if it is a power of three.Follow up: Could you do it without using any loop / recursion?Credits: Special thanks to @d...

2018-03-28 14:30:58 168

原创 LeetCode.204.Count Primes

原题链接:Count Primes题目内容: Description:Count the number of prime numbers less than a non-negative number, n.Credits: Special thanks to @mithmatt for adding this problem and creating all test cases...

2018-03-28 11:54:27 87

原创 LeetCode.412.Fizz Buzz

原题链接:Fizz Buzz题目内容:Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of f...

2018-03-23 17:46:31 132

转载 Solution for hanging workers (Celery)

Celery文档两种解决方式:如果确认是应为当前worker的并发是prefork(多进程),并且可能是由于死锁原因造成!那么可以使用 CELERYD_FORCE = True ,这样可以有效防止死锁。即使不是这个原因造成的,也尽量加上。注意:这种处理方式在4.0之后的版本不支持了,使用时需检查版本,也可采用下面的方式第二种解决方式使用与大多数进程hanging的情况...

2018-03-23 17:22:41 224

原创 LeetCode.36.Valid Sudoku

原题链接:Valid Sudoku题目内容:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A...

2018-03-23 17:19:53 122

原创 LeetCode.1.Two Sum

原题链接:Two Sum题目内容:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you ma...

2018-03-20 18:09:49 95

原创 LeetCode.283.Move Zeroes

原题链接:Move Zeroes题目内容:Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12]...

2018-03-19 19:04:46 111

原创 LeetCode.66.Plus One

原题链接:Plus One题目内容:Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 i...

2018-03-16 11:25:02 122

原创 一些Unicode字符总结

控制字符包含了\n\t\r\f等,将他们统一替换为空字符串。这里面没有包含空格。将U+007F->DEL也包含在里面了。control_chars = u”[\u0000-\u001F\u007f-\u009f]”标点和数字 替换为空 引号、中划线、加号除外other_chars = u”[\u0021-\u0026\u0028-\u002a\u002c\u002e-\u0040...

2018-03-16 10:32:22 950

原创 nginx CORS 配置

nginx 跨域请求## Wide-open CORS config for nginx#location / {if ($request_method = ‘OPTIONS’) {add_header ‘Access-Control-Allow-Origin’ ‘*’;## Om nom nom cookies#add_header ‘Access-Contro...

2018-03-02 12:00:24 677

原创 常用正则表达式总结

1. 特殊要求正则ip地址\(\(\d\{1,2}\|1\d\{2}\|2[0-4]\d\|25[0-5]\)\.\)\{3}\(\d\{1,2}\|1\d\{2}\|2[0-4]\d\|25[0-5]\)日期格式^\d{4}-\d{1,2}-\d{1,2}中文Chinese[\u4e00-\u9fa5]+俄文Russian[АБВГ...

2018-03-01 16:20:28 411

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除