Skip to content

Instantly share code, notes, and snippets.

Avatar
🤒
Wuhan Lock Down

朱聖黎 digglife

🤒
Wuhan Lock Down
View GitHub Profile
@digglife
digglife / github_release_script.sh
Created Apr 3, 2020 — forked from Jaskaranbir/github_release_script.sh
Shell script to create GitHub releases with automatically generated changelogs (using github-changelog-generator).
View github_release_script.sh
#!/bin/bash
# ===> Set these variables first
branch="$GIT_BRANCH"
# Example: "Jaskaranbir/MyRepo"
repo_slug="$TRAVIS_REPO_SLUG"
token="$GITHUB_TOKEN"
version="$TRAVIS_TAG"
# An automatic changelog generator
@digglife
digglife / split_youtube_music.py
Last active Nov 5, 2018
根据 YouTube 上传者提供的 Timeline 分割音频文件
View split_youtube_music.py
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""split audio downloaded from youtube with the text format timeline such as:
00:00 Trailer 1 Theme
02:41 Trailer 2 Theme
04:49 Trailer Theme 3
05:13 PS4 Home Theme
06:41 Dynamic Screen Theme
09:13 Intro Theme
@digglife
digglife / getMangaCover.py
Created Aug 29, 2018
根据漫画名称获取封面图片
View getMangaCover.py
#!/usr/bin/env python3
import sys
import requests
from bs4 import BeautifulSoup
URL_HOME = 'https://www.ebookjapan.jp'
def search(keyword):
View timeSync.bat
@echo on & @setlocal enableextensions
@echo =========================
@echo Turn off the time service
net stop w32time
@echo ======================================================================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server
w32tm /config /syncfromflags:manual /manualpeerlist:"0.it.pool.ntp.org 1.it.pool.ntp.org 2.it.pool.ntp.org 3.it.pool.ntp.org"
@echo =============================================
@echo ... and then turn on the time service back on
net start w32time
@digglife
digglife / wikisource.py
Last active Aug 5, 2016
Generate epub book for wikisource. For example:https://zh.wikisource.org/wiki/宋史紀事本末
View wikisource.py
#-*- encoding: utf8 -*-
import sys
import uuid
import requests
import logging
import time
from ebooklib import epub
from bs4 import BeautifulSoup as bs
@digglife
digglife / reformat_annotation.py
Last active Apr 16, 2016
重新格式化经史子集中的正文和注释。脚本中以《庄子集释》为例。
View reformat_annotation.py
#!/usr/bin/env python
# encoding:utf-8
import re
import os
import json
from bs4 import BeautifulSoup as bs
chinese_number = u"○一二三四五六七八九"
annotation_cats = {
u'注': 'zhu',
@digglife
digglife / iBooksEpubBackup.py
Created Sep 30, 2015
Backup EPUB files in iBooks Library
View iBooksEpubBackup.py
#!/usr/bin/python
import os
import sys
import zipfile
import getopt
from biplist import readPlist
book_path = os.path.join(os.path.expanduser("~"),
@digglife
digglife / fabric_monkey_patch.py
Last active Aug 29, 2015 — forked from diyan/fabric_monkey_patch.py
Fabric monkey patch for replacing SSH transport with WinRM
View fabric_monkey_patch.py
import sys
import time
import subprocess
import types
from tempfile import TemporaryFile
def remote_sh(target_host, login, password, command_text, stdout=None, stderr=None):
winrs_text = 'winrs -remote:{0} -username:{1} -password:{2} -noprofile {3}'.format(
target_host, login, password, command_text)
#print('winrs text: {0}\n'.format(winrs_text))
@digglife
digglife / fixpoodlewin.pp
Last active Aug 29, 2015
Fix Poodle Vulnerability(Disable SSLv3) on Windows Servers with Puppet
View fixpoodlewin.pp
# Disable SSLv3 on Windows.(POODLE vulnerability)
# https://technet.microsoft.com/en-us/library/security/3009008.aspx
registry_value { "Disable SSLv3 for IE":
path => 'HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\SecureProtocols',
ensure => present,
type => 'dword',
data => 128,
}
@digglife
digglife / ppdeploy.bat
Last active Jun 20, 2018
Batch Script for deploying puppet agent
View ppdeploy.bat
@ECHO OFF
REM Get Administrator Privilege on Windows 6+
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
IF '%errorlevel%' NEQ '0' (
ECHO Requesting administrative privileges...
GOTO UACPrompt
) ELSE ( GOTO gotAdmin )
:UACPrompt
You can’t perform that action at this time.