使用本指令碼即代表你同意本免責聲明。
本指令碼用於繞過臺灣電子書與教學工具的前端驗證,達成不需要教師帳號即可使用。
""" | |
Single Responsibility Principle | |
“…You had one job” — Loki to Skurge in Thor: Ragnarok | |
A class should have only one job. | |
If a class has more than one responsibility, it becomes coupled. | |
A change to one responsibility results to modification of the other responsibility. | |
""" | |
class Animal: | |
def __init__(self, name: str): |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"unicode" | |
"golang.org/x/crypto/ssh/terminal" | |
) |
---------------------------------------- | |
Setup Install HAProxy 1.8 on Ubuntu 16 | |
---------------------------------------- | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:vbernat/haproxy-1.8 | |
sudo apt-get update | |
apt-cache policy haproxy | |
sudo apt install haproxy | |
sudo update-rc.d haproxy enable |
const http = require('http') | |
const crypto = require('crypto') | |
const server = http.createServer((req, res) => { | |
console.log('got request', req.url) | |
res.writeHead(200, { 'Content-Type': 'text/plain' }) | |
res.end('okay') | |
}) | |
server.on('upgrade', function (req, socket) { |
使用本指令碼即代表你同意本免責聲明。
本指令碼用於繞過臺灣電子書與教學工具的前端驗證,達成不需要教師帳號即可使用。
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
sizeFormatter = new Intl.NumberFormat([], { | |
style: "unit", | |
unit: "byte", | |
notation: "compact", | |
unitDisplay: "narrow", | |
}); | |
(_bytes) => { | |
const units = { B: " bytes", KB: " kb", MB: " mb", GB: " gb", TB: " tb" }; | |
const parts = sizeFormatter.formatToParts(_bytes); |
# stop script on error signal | |
set -e | |
# remove old deployment folders | |
if [ -d "/home/forge/deploy" ]; then | |
rm -R /home/forge/deploy | |
fi | |
if [ -d "/home/forge/backup" ]; then | |
rm -R /home/forge/backup | |
fi |
If you don't want to deal with styling a mostly text-based HTML document, plop these lines in and it'll look good:
html {
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
font-size: 1.3em;
max-width: 40rem;
padding: 2rem;
margin: auto;
line-height: 1.5rem;