View github_repo_https_to_git.sh
This file contains 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
git remote -v | head -1 |awk '{ print $2 }' | sed 's/https:\/\//git remote set-url origin git@/g' | sed 's/.com\//.com:/g' |
View fix_url_encoded_filename.py
This file contains 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
# -*- 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' |
View lastpass2keepass.py
This file contains 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
# lastpass2keepass | |
# Supports: | |
# Keepass XML - keepassxml | |
# USAGE: python lastpass2keepass.py 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 |
View pip2poetry.py
This file contains 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 | |
from __future__ import absolute_import | |
import argparse | |
import os | |
import subprocess | |
def normalize(line): | |
line = line.strip('\n') | |
if line.startswith('#') or line.startswith('-'): |
View pushover-bookmarklet.js
This file contains 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
var text = window.prompt('Enter the message to push, or leave empty and push the current url.'); | |
if (text=="") { | |
text=window.location.href | |
} | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', 'https://api.pushover.net/1/messages.json'); | |
xhr.setRequestHeader('Content-Type', 'application/json'); | |
xhr.send(JSON.stringify({ | |
token: 'APP_TOKEN', | |
user: 'USER_KEY', |
View bilibili_screenshots.py
This file contains 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 -*- | |
""" | |
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 |
View ClipperHelper.js
This file contains 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
var d = document, | |
useMine = true, | |
prevEl; | |
function AddHandler(orig, mine) { | |
return function(e) { | |
if (useMine) mine(e); | |
else if (orig) orig(e); | |
}; | |
} |
View vtt2text.py
This file contains 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
""" | |
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. |
View outlook_web_batch_delete.js
This file contains 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
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function deleteMails() { | |
jQuery('._n_U').click() | |
await sleep(500); | |
jQuery('.ms-fcl-np[title="删除(Del)"]').click() | |
} |
View adminLteColors.html
This file contains 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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>AdminLTE 2 Colors</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"`> | |
<link rel="stylesheet" href="https://almsaeedstudio.com/themes/AdminLTE/dist/css/AdminLTE.min.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<table class="table table-bordered"> |
NewerOlder