Skip to content

Instantly share code, notes, and snippets.

Avatar

春消息 bsmagic

  • Tokamak
View GitHub Profile
@bsmagic
bsmagic / gist:0da419d570abac1e908b94465886a404
Last active May 31, 2021
A bookmarklet for richtext editor without 3rd-part javascript code
View gist:0da419d570abac1e908b94465886a404
data:text/html;base64,PGh0bWw+CjxoZWFkPgo8dGl0bGU+UmljaCBUZXh0IEVkaXRvcjwvdGl0bGU+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KdmFyIG9Eb2MsIHNEZWZUeHQ7CgpmdW5jdGlvbiBpbml0RG9jKCkgewogIG9Eb2MgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgidGV4dEJveCIpOwogIHNEZWZUeHQgPSBvRG9jLmlubmVySFRNTDsKICBpZiAoZG9jdW1lbnQuY29tcEZvcm0uc3dpdGNoTW9kZS5jaGVja2VkKSB7IHNldERvY01vZGUodHJ1ZSk7IH0KfQoKZnVuY3Rpb24gZm9ybWF0RG9jKHNDbWQsIHNWYWx1ZSkgewogIGlmICh2YWxpZGF0ZU1vZGUoKSkgeyBkb2N1bWVudC5leGVjQ29tbWFuZChzQ21kLCBmYWxzZSwgc1ZhbHVlKTsgb0RvYy5mb2N1cygpOyB9Cn0KCmZ1bmN0aW9uIHZhbGlkYXRlTW9kZSgpIHsKICBpZiAoIWRvY3VtZW50LmNvbXBGb3JtLnN3aXRjaE1vZGUuY2hlY2tlZCkgeyByZXR1cm4gdHJ1ZSA7IH0KICBhbGVydCgiVW5jaGVjayBcIlNob3cgSFRNTFwiLiIpOwogIG9Eb2MuZm9jdXMoKTsKICByZXR1cm4gZmFsc2U7Cn0KCmZ1bmN0aW9uIHNldERvY01vZGUoYlRvU291cmNlKSB7CiAgdmFyIG9Db250ZW50OwogIGlmIChiVG9Tb3VyY2UpIHsKICAgIG9Db250ZW50ID0gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUob0RvYy5pbm5lckhUTUwpOwogICAgb0RvYy5pbm5lckhUTUwgPSAiIjsKICAgIHZhciBvUHJlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgicHJlIik7CiAgICBvRG9jLmNvbnRlbn
@bsmagic
bsmagic / onelineEditorBookmarklet++.html
Created Jan 4, 2021
Oneline javascript bookmarklet richtext editor
View onelineEditorBookmarklet++.html
data:text/html,<title>RTextEditor</title><html contenteditable style="font-size: 1.5em; width: 100%; height: 100%; border: none; outline: none;background-color:powderblue;"><input type=button value="B" onClick="document.execCommand('Bold');"/><hr><div id="editbox">Text</div></html>
@bsmagic
bsmagic / pipTest.py
Last active Jan 16, 2021
Check Pip version
View pipTest.py
import numpy as np
import scipy as sp
import pandas as pd
import pip
if pip.__version__ >= "10.0.0":
from pip._internal.utils.misc import get_installed_distributions
else:
from pip import get_installed_distributions
@bsmagic
bsmagic / createNotepadbyBookmaklet.md
Last active Dec 30, 2020
Oneline temporary text editor created by bookmarklet in modern web browsers
View createNotepadbyBookmaklet.md
data:text/html, <title>TextEditor</title><textarea style="font-size: 1.5em; width: 100%; height: 100%; border: none; outline: none;background-color:powderblue;" autofocus />

"程序员 Jose Jesus Perez Aguinaga 在 CoderWall 分享了一个小技巧:在浏览器地址栏中输入一行代码:data:text/html, ,回车即可把浏览器变临时编辑器(需要浏览器支持 HTML5 属性 contenteditable)。

@bsmagic
bsmagic / onenoteClipperHotkey.ahk
Last active Dec 30, 2020
Support using hotkey to clip the selected content to local onenote
View onenoteClipperHotkey.ahk
;An autohotkey script
EnvGet, ProgramFiles32, ProgramFiles(x86)
onenote := "\Microsoft Office\root\Office16\ONENOTE.EXE"
onenote32 := ProgramFiles32 . onenote
onenote64 := A_ProgramFiles . onenote
;msgbox, % onenote32
ONENOTE_PATH:="C:\Program Files\Microsoft Office\root\Office16\ONENOTE.EXE"
if FileExist(onenote64) {
ONENOTE_PATH:=onenote64
@bsmagic
bsmagic / listen1_aha_playlist.md
Created Mar 14, 2020
updated by Listen1(http://listen1.github.io/listen1/) at 2020/3/14 下午5:27:08
View listen1_aha_playlist.md

本歌单由Listen1创建, 歌曲数:2,歌单数:1,点击查看更多