This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| try: | |
| from PyPDF2 import PdfFileReader, PdfFileWriter | |
| except ImportError: | |
| from pyPdf import PdfFileReader, PdfFileWriter | |
| import os | |
| def concatenate(input_files, output_file): | |
| input_streams = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyhive import hive# or import hive | |
| from pyhdfs import HdfsClient | |
| data_csv = '/root/demo/data/train.csv' | |
| hdfs = HdfsClient('hadoopmaster.hadoop.test', user_name='admin') | |
| hdfs.copy_from_local(data_csv, '/user/admin/data/titanic/train.csv') | |
| hive_cursor= hive.connect('hadoopslave1.hadoop.test', username='admin').cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Origin: https://github.com/RussellLuo/pdfbookmarker | |
| import sys | |
| import os | |
| import re | |
| from PyPDF2 import PdfFileMerger, PdfFileReader | |
| def addBookmarks(pdf_in_filename, bookmarks_tree, pdf_out_filename=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ffmpeg -i \#Architecture.mov -ss 00:00:01 -vcodec libx264 -preset fast -crf 23 -vf "scale=640:-1" -acodec libmp3lame -ab 128k architecure.mp4 | |
| # -ss 00:00:01 cut begin at 00:00:01 | |
| # -crf 23 压缩程度(数字越大,体积越小) | |
| # -vf "scale=640:-1" 缩放 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;----------------------------------- | |
| ; Macro Recorder v2.1 By FeiYue | |
| ; | |
| ; Description: This script records the mouse | |
| ; and keyboard actions and then plays back. | |
| ; | |
| ; F1 --> Record(Screen) (CoordMode, Mouse, Screen) | |
| ; F2 --> Record(Window) (CoordMode, Mouse, Window) | |
| ; F3 --> Stop Record/Play | |
| ; F4 --> Play LogFile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| import os | |
| im_list = [Image.open('abc/'+i).convert('RGB') for i in sorted(os.listdir('abc')) if i.endswith(".png")] | |
| im_list[0].save('output.pdf', "PDF" ,resolution=100.0, save_all=True, append_images=im_list[1:]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| // js code | |
| function di(page) { | |
| var canName = "page_" + page; | |
| var canvas = document.getElementById(canName); | |
| var dataUrl = canvas.toDataURL(); | |
| //console.log(dataUrl) | |
| $.post('http://localhost:19290/'+page+'.png', dataUrl) | |
| } | |
| for (let i = 69; i <= 75; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import img2pdf | |
| # =========== 总流程 ============ | |
| # pdf --> jpg (抽取内部原有的jpg) | |
| # 过滤掉不要的图片 | |
| # jpg --> pdf | |
| # =============================== | |
| def extract_all_jpg_from_pdf(pdf_file): | |
| res = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pathlib import Path | |
| import soundfile as sf | |
| from tqdm import tqdm | |
| def get_info(audio_file_list): | |
| res = [] | |
| for wav in tqdm(audio_file_list): | |
| if not Path(wav).exists(): | |
| print(f"Warning: File not exists: {wav}") | |
| continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Reference: https://forums.zotero.org/discussion/82558/rdf-extra-field | |
| var fieldName = "extra"; | |
| var fieldID = Zotero.ItemFields.getID(fieldName); | |
| var s = new Zotero.Search(); | |
| s.libraryID = Zotero.Libraries.userLibraryID; | |
| s.addCondition(fieldName, 'contains', ': '); | |
| s.addCondition('joinMode', 'any'); | |
| var ids = await s.search(); |