Skip to content

Instantly share code, notes, and snippets.

View subtly's full-sized avatar
🤓
🧹 📁 🗄️ 📚

subtly

🤓
🧹 📁 🗄️ 📚
View GitHub Profile
@subtly
subtly / disktemp-macos.rb
Created February 20, 2020 06:58
Get disk temperatures in macOS (nvme can get hot)
#!/usr/bin/env ruby
lines = `diskutil list physical|grep dev|awk -F ' ' '{print $1}'`
lines.gsub(/\/dev\//, '').each_line do |line|
out = `smartctl -A -f brief #{line}` if !!(line.gsub!(/\s/,'') =~ /\Adisk\d+\z/)
puts "#{line}: " + out.split("\n").grep(/Temperature:/).first.split(/\s/)[-2]
end
@subtly
subtly / disktemp-macos.rb
Created February 20, 2020 06:58
Get disk temperatures in macOS (nvme can get hot)
#!/usr/bin/env ruby
lines = `diskutil list physical|grep dev|awk -F ' ' '{print $1}'`
lines.gsub(/\/dev\//, '').each_line do |line|
out = `smartctl -A -f brief #{line}` if !!(line.gsub!(/\s/,'') =~ /\Adisk\d+\z/)
puts "#{line}: " + out.split("\n").grep(/Temperature:/).first.split(/\s/)[-2]
end
@subtly
subtly / channeltype.rs
Last active April 9, 2018 23:29
rust learning puzzle #1
use std::thread;
use std::sync::mpsc::channel;
fn main() {
let (tx, rx) = channel();
// How to modify closure so only tx is captured? (without extra struct)
thread::spawn(move |tx| {
tx.send(String::from("hi")).unwrap();
});
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Eth_DEVCORE_LIBRARY
linked by target "webthree" in directory /path/to/webthree/libwebthree
linked by target "webthree" in directory /path/to/webthree/libwebthree
linked by target "webthree" in directory /path/to/webthree/libwebthree
linked by target "webthree" in directory /path/to/webthree/libwebthree
linked by target "webthree" in directory /path/to/webthree/libwebthree
linked by target "webthree" in directory /path/to/webthree/libwebthree
linked by target "webthree" in directory /path/to/webthree/libwebthree
or: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ETH_ETHASH-CL_LIBRARY
linked by target "solidity" in directory /Users/nessence/code/cpp-ethereum/solidity/libsolidity
linked by target "solc" in directory /Users/nessence/code/cpp-ethereum/solidity/solc
linked by target "soltest" in directory /Users/nessence/code/cpp-ethereum/solidity/test
linked by target "webthree" in directory /Users/nessence/code/cpp-ethereum/webthree/src/libwebthree
linked by target "webthree" in directory /Users/nessence/code/cpp-ethereum/webthree/src/libwebthree
linked by target "web3jsonrpc" in directory /Users/nessence/code/cpp-ethereum/webthree/src/libweb3jsonrpc
linked by target "web3testutils" in directory /Users/nessence/code/cpp-ethereum/webthree/src/libweb3testutils
116521 6d45feba9b4611b56bc3ffe6ac642c03eaecdf6a6a884d372e48c6556fe5cb11
116522 05bef30ef572270f654746da22639a7a0c97dd97a7050b9e252391996aaeb689
116523 d088aff6a885ca3ceee46d40150632252b662705e99f3b0142854699752052f7
116524 f177e278d01947022b43d12d126b689091514a3d514a8043bd8095ba144975da
116525 559c1eae20699b3252bf5c550d44b7c8c7f9b1c67875c098e64ccec790c42d9c
116526 668171ab343621869ffb82547e1ab0566d2bf665aab5428de69526e1c5d70483
116527 469ad69c72d61b88cfb499471c99c6722b0dcbf30c93c2f9a6f66b7265e825f5
116528 b9dae0e50eea5a5b73e3ac1aca299ba33d4b357e4946a0d9f381a66165a2f29d
116529 61b691edf8406479a74b170c2363fd4e2a53dac91f9abdf851d43faf1d751a3e
116530 02619da4690d15226683abb2fa61e0b187f58eb68c1c1e0626f59853f590cae0
for (var i = 116522; i <= eth.blockNumber; i++) {
if (i % 200 == 0) {
console.log(i);
console.log(eth.getBlock(i).hash);
}
}
console.log("end");
979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9
Eth Window:
bash-3.2$ ./eth -a "0x797b360b934e76b7dd16a7a191560cc450a6771d" --upnp off --master " " --listen 30303 -v 10 -j -m off -x 1 -r 127.0.0.1
(++)Ethereum
Welcome to Olympic!
⧎ ℹ 16:07:11| Id: ##6061aa11…
ℹ 16:07:11| Opened blockchain DB. Latest: #fd4af92a… (rebuild not needed)
ℹ 16:07:11| Opened state DB.
⧫ ◎ 16:07:12|eth startedWorking()
Ethereum (++) 0.9.35
Code by Gav Wood et al, (c) 2013, 2014, 2015.
⧎ ◌ 23:27:20|p2p|06f70376…|Geth/v0.9.39/linux/go1.4.2 BlockHashes ( 512 entries)
⧎ ◌ 23:27:20|p2p|06f70376…|Geth/v0.9.39/linux/go1.4.2 0 knowns, 512 unknowns; now at #907b3003…
⧎ ○ 23:27:20|p2p|06f70376…|Geth/v0.9.39/linux/go1.4.2 Requesting block hashes staring from #907b3003…
⧎ ◌ 23:27:20|p2p|ed0ef103…|Geth/haSG.node.003/v0.9.39/linux/go1.4.2 BlockHashes ( 1 entries)
⧎ ◌ 23:27:20|p2p|ed0ef103…|Geth/haSG.node.003/v0.9.39/linux/go1.4.2 Transition! Hashes from Hashes , syncing & needed
⧎ ○ 23:27:20|p2p|ed0ef103…|Geth/haSG.node.003/v0.9.39/linux/go1.4.2 Requesting block hashes for numbers 919045 - 921092
⧎ ◌ 23:27:20|p2p|db5cc02a…|Geth/v0.9.38/darwin/go1.4.2 BlockHashes ( 512 entries)
⧎ ◌ 23:27:20|p2p|db5cc02a…|Geth/v0.9.38/darwin/go1.4.2 0 knowns, 512 unknowns; now at #d9c3e03f…
⧎ ○ 23:27:20|p2p|db5cc02a…|Geth/v0.9.38/darwin/go1.4.2 Requesting block hashes staring from #d9c3e03f…
⧎ ▢ 23:27:20|p2p Attempting connection to node ##48761142… @ tcp://5.1.83.226:30303 from ##9ab90bfa…