javascript:(function(){'use strict';var getFontSize=function(el){return parseFloat(getComputedStyle(el,null)['font-size']);};document.addEventListener('wheel',function(e){if(!e.altKey)return;e.preventDefault();var el=e.target;var parent=el.parentElement;var size=getFontSize(el);while(parent&&size===getFontSize(parent)){el.style.fontSize='inherit';el=parent;parent=parent.parentElement;}
if(e.wheelDelta>0){size+=1;}else{size-=1;}
console.log(size);el.style.fontSize=size+'px';el.style.lineHeight='1.2em';});}());
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 python3 | |
# -*- coding: ascii -*- | |
# 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 | |
# /System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/0cab8989af7642f18332cfdc038d97017d28586a.asset/AssetData/Spanish - English.dictionary/Contents/Resources/Body.data | |
import sys |
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
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
import os | |
# function to take care of downloading file | |
def enable_download_headless(browser,download_dir): | |
browser.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command') | |
params = {'cmd':'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}} | |
browser.execute("send_command", params) |
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
from selenium import webdriver | |
profile = webdriver.FirefoxProfile() | |
# Set proxy settings to manual | |
profile.set_preference('network.proxy.type', 1) | |
# Set proxy to Tor client on localhost | |
profile.set_preference('network.proxy.socks', '127.0.0.1') | |
profile.set_preference('network.proxy.socks_port', 9050) | |
# Disable all images from loading, speeds page loading | |
# http://kb.mozillazine.org/Permissions.default.image |
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 | |
# encoding: utf-8 | |
import lxml.etree | |
import lxml.html | |
import requests | |
xml_sample = """<?xml version="1.0" encoding="UTF-8"?> | |
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com"> | |
<foo:Recordset setCount="2"> |
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
''' | |
HTTP Reuests has following parameters: | |
1)Request URL | |
2)Header Fields | |
3)Parameter | |
4)Request body | |
''' | |
#!/usr/bin/env python | |
import requests |
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 bash | |
# Small shell script to more easily automatically download and transcribe live stream VODs. | |
# This uses YT-DLP, ffmpeg and the CPP version of Whisper: https://github.com/ggerganov/whisper.cpp | |
# Use `./transcribe-vod help` to print help info. | |
# MIT License | |
# Copyright (c) 2022 Daniils Petrovs |
-
Go to https://cachedview.com/
-
Navigate to the deleted repo, e.g. https://webcache.googleusercontent.com/search?q=cache:https://github.com/apcera/termtables
-
Copy latest known commit sha1 signature
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from fairseq.models.transformer import TransformerModel | |
zh2en = TransformerModel.from_pretrained( | |
'/path/to/checkpoints', | |
checkpoint_file='checkpoint_best.pt', | |
data_name_or_path='data-bin/wmt17_zh_en_full', | |
bpe='subword_nmt', | |
bpe_codes='data-bin/wmt17_zh_en_full/zh.code' | |
) | |
zh2en.translate('你好 世界') |