汇编是直接跟硬件打交道的, 于是在学习汇编的同时,不经意间就了解到计算机的工作原理。
这是饭前开胃菜,作者从什么是电流开始,讲加法器、数字逻辑、触发器、CPU 原理、外设等,是计算机(硬件)组成原理的科普向轻松读物
use std::fs::File; | |
use std::io::prelude::*; | |
use std::mem; | |
fn layernorm_forward(output: &mut [f32], mean: &mut [f32], rstd: &mut [f32], | |
input: &[f32], weight: &[f32], bias: &[f32], | |
batch_size: usize, time_steps: usize, channels: usize) { | |
let epsilon = 1e-5; | |
for b in 0..batch_size { | |
for t in 0..time_steps { |
from requests.adapters import HTTPAdapter, Retry | |
from requests import Session | |
retries = Retry( | |
total=5, backoff_factor=1, status_forcelist=[502, 503, 504] | |
) | |
session = Session() # reuse tcp connection | |
session.mount("http://", HTTPAdapter(max_retries=retries)) | |
session.mount("https://", HTTPAdapter(max_retries=retries)) |
#!/usr/bin/env python | |
## Dependencies: | |
# | |
# pip install qiniu | |
# | |
## Tips for Deploy certs to Qiniu: | |
# | |
# export DOMAIN=lewangdev.com | |
# export QINIU_DOMAIN=images.${DOMAIN},staticfiles.${DOMAIN} |
#!/bin/bash | |
hash git 2>/dev/null || { echo >&2 "Required command 'git' is not installed. ( hmm... why are you using this? ) Aborting."; exit 1; } | |
hash realpath 2>/dev/null || { echo >&2 "Required command 'realpath' is not installed. Aborting."; exit 1; } | |
hash pwd 2>/dev/null || { echo >&2 "Required command 'pwd' is not installed. Aborting."; exit 1; } | |
hash cd 2>/dev/null || { echo >&2 "Required command 'cd' is not installed. Aborting."; exit 1; } | |
hash echo 2>/dev/null || { echo >&2 "Required command 'echo' is not installed. Aborting."; exit 1; } | |
hash mv 2>/dev/null || { echo >&2 "Required command 'mv' is not installed. Aborting."; exit 1; } | |
hash diff 2>/dev/null || { echo >&2 "Required command 'diff' is not installed. Aborting."; exit 1; } | |
hash diffstat 2>/dev/null || { echo >&2 "Required command 'diffstat' is not installed. Aborting."; exit 1; } |
#!/usr/bin/sudo bash | |
# | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
systemctl enable runsunloginclient.service | |
systemctl start runsunloginclient.service | |
# change USERNAME to your current non-root username | |
sudo -u USERNAME /usr/local/sunlogin/bin/sunloginclient & |
# This DNSMasq configuration forces restrictions to be enabled for YouTube, Bing, and Google Search | |
# for more information see: https://learn.akamai.com/en-us/webhelp/enterprise-threat-protector/enterprise-threat-protector/GUID-0FCB1221-60DC-4A01-9B09-0C25B16BF3D0.html | |
# or see: https://support.google.com/youtube/answer/6214622?hl=en | |
# Put this file in /etc/dnsmasq.d/ | |
## YouTube | |
cname=www.youtube.com,restrictmoderate.youtube.com | |
cname=m.youtube.com,restrictmoderate.youtube.com | |
cname=youtube.googleapis.com,restrictmoderate.youtube.com | |
cname=youtubei.googleapis.com,restrictmoderate.youtube.com |
#!/bin/bash | |
# Before running this script, make sure you have sysbench installed: | |
# sudo apt-get install sysbench | |
# | |
# This script helps you check if your Raspberry pi is correctly powered. | |
# You can read more about Raspberry pi powering issues here: https://ownyourbits.com/2019/02/02/whats-wrong-with-the-raspberry-pi/ | |
# If you're pi is correctly powered (stable power supply and quality cable), after running the script, you should get something like: |