Skip to content

Instantly share code, notes, and snippets.

@evmn
evmn / Webvision.py
Last active February 16, 2022 09:11
Calibre Recipe For <WEBVISION: The Organization of the Retina and Visual System>. First rename Webvision.py to Webvision.recipe
#!/usr/bin/env python
# encoding: utf-8
from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup
from datetime import datetime
base_url = 'https://webvision.med.utah.edu/'
class Web_Vision(BasicNewsRecipe):
title = 'WEBVISION: The Organization of the Retina and Visual System'
@evmn
evmn / bashrc
Created October 26, 2021 07:01
function proxy_off(){
unset http_proxy
unset https_proxy
echo -e "已关闭代理"
}
function proxy_on() {
export no_proxy="localhost,127.0.0.1,192.168.1.1/24"
export http_proxy="http://127.0.0.1:8118"
export https_proxy=$http_proxy
Author Title
Yuval Noah Harari Sapiens
Viktor E. Frankl Man's Search for Meaning
Daniel Kahneman Thinking, Fast and Slow
Ray Dalio Principles
Robert B. Cialdini, PhD Influence
Tim Ferriss The 4-Hour Workweek
Peter Thiel Zero to One
Ben Horowitz The Hard Thing About Hard Things
@evmn
evmn / thumbnail.sh
Last active October 18, 2021 11:59
Generate thumb for cover.jpg generate by Calibre
#!/bin/bash
find ./ -type f -name cover.jpg | while read -r cover;do
backup=`echo "$cover" | sed -e 's/cover\.jpg$/cover_bak\.jpg/'`
thumb=`echo "$cover" | sed -e 's/cover\.jpg$/thumb\.jpg/'`
# thumb=$(echo "$cover" | rev | cut -d "/" -f 2- | rev)"/thumb.jpg"
echo "$thumb"
width=$(identify -format '%w' "$cover")
if (( width < 350 ));then
cp "$cover" "$thumb"
elif (( width >=350 && width < 600 ));then
for i in {1..10}
do
cat /dev/urandom | \
tr -dc "a-f0-9"| \
fold -w 36 | \
head -n 1 | \
sed -E -e 's/(.{8}).(.{4}).(.{4}).(.{4}).(.*)/\1-\2-\3-\4-\5/' | \
sed -E -e 's/(.{14}).(.*)/\14\2/' | \
sed -E -e "s/(.{19}).(.*)/\1$(shuf -n 1 -e 8 9 a b)\2/"
done
@evmn
evmn / uuid.sh
Created September 16, 2020 06:38
generate 30 uuid
#!/bin/bash
cat /dev/urandom | \
tr -dc "a-f0-9"| \
fold -w 36 | \
head -n 30 | \
sed -E -e 's/(.{8}).(.{4}).(.{4}).(.{4}).(.*)/\1-\2-\3-\4-\5/'
@evmn
evmn / subtitle_to_audio.py
Created July 14, 2020 03:49
xfyun(迅飞云)根据格式化后的字幕批量语音合成
# -*- coding:utf-8 -*-
#
# author: iflytek
#
# 本demo测试时运行的环境为:Windows + Python3.7
# 本demo测试成功运行时所安装的第三方库及其版本如下:
# cffi==1.12.3
# gevent==1.4.0
# greenlet==0.4.15
# pycparser==2.19
@evmn
evmn / openshot_time_format.sh
Created July 13, 2020 00:46
mp3 files that will be used in Openshot
#!/bin/bash
# Output file will be used in Openshot
# Input format: 11-22.33.mp3, means this mp3 start at video time 11 min 22.33 sec
# Output as 682.33.mp3
for audio in *.mp3
do
min=`echo $audio | cut -d- -f 1`
sec=`echo $audio | cut -d- -f 2 | cut -d. -f 1`
#/bin/bash
declare -a remote_dirs=("sdcard/inshot/"
"sdcard/DCIM/"
"sdcard/Pictures/"
"sdcard/Download"
"sdcard/Movies/")
bak=bak_$(date +"%Y%m%d-%H%M%S")
for dir in "${remote_dirs[@]}"

How to unbrick an Amazon Kindle Paperwhite™

This guide instructs you in how to unbrick an Amazon Kindle Paperwhite. The consequences of following it are your own responsibility. This method (opening the Kindle and using the serial interface) should be a last resort and should only be considered if other methods fail

The Guide

  1. Pry open Kindle using a prying tool
  2. Unscrew the screen and remove it from the base. Note that there's a screw hidden under the adhesive at the top in the middle
  3. Solder tin wire to serial ports on the bottom
  4. Attach tin wire to USB TTY device (order is ground, RX, TX, from the kindle's perspective, where GND is the smallest pad) and plug USB TTY device into your computer
  5. Open Putty on your computer in serial mode, with the serial port specified as your USB device and baud configured to 115200