Skip to content

Instantly share code, notes, and snippets.

glasslion /
Created October 15, 2019 08:13
将 repo 转为 git
git remote -v | head -1 |awk '{ print $2 }' | sed 's/https:\/\//git remote set-url origin git@/g' | sed 's/.com\//.com:/g'
glasslion /
Created October 15, 2019 07:32
修复 Linux 下载的 urlencode 过的文件名
# -*- coding: utf-8 -*-
import glob
import os
import urllib
def confirm(text):
answer = raw_input(text)
answer = answer.lower()
return answer == 'y' or answer == 'yes'
# lastpass2keepass
# Supports:
# Keepass XML - keepassxml
# USAGE: python exportedTextFile
# The LastPass Export format;
# url,username,password,1extra,name,grouping(\ delimited),last_touch,launch_count,fav
import sys, csv, time, datetime, itertools, re, operator # Toolkit
import xml.etree.ElementTree as ET # Saves data, easier to type
glasslion /
Created July 12, 2019 02:21
一个把 pip requirements 转换成 poetry依赖的脚本
#!/usr/bin/env python
from __future__ import absolute_import
import argparse
import os
import subprocess
def normalize(line):
line = line.strip('\n')
if line.startswith('#') or line.startswith('-'):
glasslion / pushover-bookmarklet.js
Last active January 28, 2022 08:33
pushover bookmarklet
View pushover-bookmarklet.js
var text = window.prompt('Enter the message to push, or leave empty and push the current url.');
if (text=="") {
var xhr = new XMLHttpRequest();'POST', '');
xhr.setRequestHeader('Content-Type', 'application/json');
token: 'APP_TOKEN',
user: 'USER_KEY',
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Bilibili Screenshots Syncer
It can download `/Pictures/bili/screenshot` from a Android phone via ftp.
It also rename the picture so the timestamp comes first.
from __future__ import print_function
import argparse
glasslion / ClipperHelper.js
Last active April 25, 2021 14:08
Bookmarklet that makes web page clipping easy.
View ClipperHelper.js
var d = document,
useMine = true,
function AddHandler(orig, mine) {
return function(e) {
if (useMine) mine(e);
else if (orig) orig(e);
glasslion /
Last active February 20, 2024 00:34
This script convert youtube subtitle file(vtt) to plain text.
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl --skip-download --convert-subs vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.
glasslion / outlook_web_batch_delete.js
Created July 3, 2017 07:11
批量删除outlook 里的邮件
View outlook_web_batch_delete.js
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
async function deleteMails() {
await sleep(500);
glasslion / adminLteColors.html
Created March 31, 2017 07:21
Color table for AdminLte
View adminLteColors.html
<meta charset="utf-8">
<title>AdminLTE 2 Colors</title>
<link rel="stylesheet" href=""`>
<link rel="stylesheet" href="">
<div class="container">
<table class="table table-bordered">