Skip to content

Instantly share code, notes, and snippets.

View muxueqz's full-sized avatar

muxueqz muxueqz

View GitHub Profile
@muxueqz
muxueqz / make_index_with_pikepdf.py
Created July 10, 2023 03:20
make pdf index/bookmark with pikepdf
#!/usr/bin/env python
import re
import sys
from pikepdf import Pdf, OutlineItem
input_str = """
007 第1章 不是咆哮,是低语
011 第2章 认识自己
1
00:00:01,039 --> 00:00:01,239
Elle va faire un beau mariage.
2
00:00:01,879 --> 00:00:43,239
...
3
00:00:43,239 --> 00:00:48,199
0
00:00:01,000 --> 00:00:04,000
1
00:00:39,866 --> 00:00:42,202
Do not miss your cone from the stoup.
- I saw them first.
2
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
function svg2png_by_lib() {
console.log("svg2png get")
let svgs = document.querySelectorAll('svg')
console.log("svg2png svgs", svgs)
for (const i of svgs) {
let pabloSvg = Pablo('#' + i.id)
console.log(pabloSvg[0].parentNode)
// let pabloImg = pabloSvg.toImage('jpeg');
let pabloImg = pabloSvg.toImage('png');
#!/usr/bin/env python3
from typing import Optional, Tuple, List
import struct
import asyncio
import pathlib
import socket
import ipaddress
from os import environ as env
from collections import deque
from typing import Optional, Tuple
- hosts: all
tasks:
- name: Create temporary file
ansible.builtin.tempfile:
state: file
suffix: temp
register: tempfile_1
- name: Use the registered var and the file module to remove the temporary file
ansible.builtin.file:
FROM ubuntu:latest
RUN : \
&& apt-get update -y --quiet \
&& apt-get install -y curl python3-pycurl wget python3-wget python3-pip gcc git \
&& apt-get clean -y --quiet
RUN : \
&& curl -o /tmp/nim.tar.xz https://nim-lang.org/download/nim-1.4.8-linux_x64.tar.xz \
&& tar xvf /tmp/nim.tar.xz \
&& mv -v nim-* /opt/ \
FROM nimlang/nim
RUN : \
&& apt-get update -y --quiet \
&& apt-get install -y curl python3-pycurl wget python3-wget python3-pip \
&& apt-get clean -y --quiet
RUN nimble -y refresh ; nimble -y install nimpy
RUN rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/nimblecache/* /var/log/journal/*
@muxueqz
muxueqz / get_page.py
Created November 2, 2020 07:37
get_page.py
#coding=utf-8
import sys
#str = raw_input()
#print str
def get_page(page_num, nums):
items = range(100)
start_num = page_num * nums
result = list(range(len(items)))[start_num:start_num + nums]
return result