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
# Thanks to commenters for providing the base of this much nicer implementation! | |
# Save and run with $ python 0dedict.py | |
# You may need to hunt down the dictionary files yourself and change the awful path string below. | |
# This works for me on MacOS 10.14 Mohave | |
from struct import unpack | |
from zlib import decompress | |
import re | |
filename = '/System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/9f5862030e8f00af171924ebbc23ebfd6e91af78.asset/AssetData/Oxford Dictionary of English.dictionary/Contents/Resources/Body.data' | |
f = open(filename, 'rb') |
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
/** | |
* Retrieve object from Chrome's Local StorageArea | |
* @param {string} key | |
*/ | |
const getObjectFromLocalStorage = async function(key) { | |
return new Promise((resolve, reject) => { | |
try { | |
chrome.storage.local.get(key, function(value) { | |
resolve(value[key]); | |
}); |
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
const isApproximateInteger = value => { | |
const min = Math.floor(value); | |
const max = Math.ceil(value); | |
return value - min <= 0.01 || max - value <= 0.01; | |
}; | |
const MAX_TRY = 120; | |
const computeToRatio = (width, height) => { |
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
{ | |
const ratioConfig = (x, y) => ({ | |
x, | |
y, | |
ratio: x / y | |
}) | |
const commonRatio = [ratioConfig(1, 1), ratioConfig(4, 3), ratioConfig(16, 9), ratioConfig(16, 10)]; | |
const getRatioConfig = (x, y) => { |
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
javascript:%22use%20strict%22;%0Alet%20iCloudUrl%20%3D%20location.href;%0Alet%20apiUrl%20%3D%20iCloudUrl.replace(/%5C/shortcuts/g,%20%22/shortcuts/api/records%22);%0Alet%20iCloudApi%20%3D%20new%20XMLHttpRequest();%0AiCloudApi.open(%22GET%22,%20apiUrl);%0AiCloudApi.responseType%20%3D%20%22text%22;%0AiCloudApi.send();%0A%0AiCloudApi.onload%20%3D%20function()%20%7B%0A%20%20let%20apiResult%20%3D%20JSON.parse(iCloudApi.response);%0A%0A%20%20function%20saveData(url)%20%7B%0A%20%20%20%20let%20a%20%3D%20document.createElement(%22a%22);%0A%20%20%20%20document.body.appendChild(a);%0A%20%20%20%20a.style%20%3D%20%22display:%20none%22;%0A%0A%20%20%20%20a.href%20%3D%20url;%0A%20%20%20%20a.download;%0A%20%20%20%20a.click();%0A%20%20%20%20window.URL.revokeObjectURL(url);%0A%20%20%7D%0A%20%20let%20downloadURL%20%3D%20apiResult.fields.shortcut.value.downloadURL;%0A%20%20let%20shortcutName%20%3D%20apiResult.fields.name.value;%0A%20%20let%20finalURL%20%3D%20downloadURL.replace(%22$%7Bf%7D%22,%20shortcutName%20+%20%22.shortcut%22 |
- HTTP 形式:
git clone https://github.com/owner/git.git
- SSH 形式:
git clone [email protected]:owner/git.git
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
# install tinc | |
apt-get update && echo "===> update deps" && | |
apt-get install -y make libssl-dev zlib1g-dev liblzo2-dev libreadline-dev libncurses5-dev && echo "===> got deps" && | |
curl http://www.tinc-vpn.org/packages/tinc-1.1pre11.tar.gz | tar xzvf - && echo "===> got tinc src" && | |
cd tinc-1.1pre11 && | |
./configure && echo "===> configured tinc" && | |
make && | |
make install && echo "===> installed tinc" && | |
tinc --version # tinc version 1.1pre11 (built Nov 12 2015 16:25:28, protocol 17.4) |
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
// ecdh implements a simple way to perform Diffie-Hellman Key Exchange using | |
// Curve25519 on the command line. | |
// | |
// NOTE: this is a toy for fun. Don't use it. | |
// | |
// See https://godoc.org/golang.org/x/crypto/curve25519 and | |
// https://cr.yp.to/ecdh.html for more info. | |
// | |
// The final shared secret given is the raw shared secret bytes from DH and is | |
// not typically suitable for direct use as an encryption key as it can leak |
NewerOlder