This is a rough draft for backing up and restoring data contained in a Docker volume. I can't say that this is a "best practice". For my limited testing at the moment, it seems sufficient.
version: '3'
#!/usr/bin/swift | |
import Foundation | |
import AppKit.NSWorkspace | |
// Returns the name of the frontmost app, or <none> if no app is frontmost | |
func currentFocusApp() -> String { | |
NSWorkspace.shared.frontmostApplication?.localizedName ?? "<none>" | |
} |
M117 Cooling down... | |
M104 S0 ; turn off extruder | |
M107 ; Fan off | |
M140 S0; Turn bed off | |
M84 ; disable motors | |
G91 ;relative positioning | |
G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure | |
G1 Z+0.5 E-5 ;X-20 Y-20 F240 ;move Z up a bit and retract filament even more | |
G28 X0 ;move X to min endstops, so the head is out of the way | |
G90 ;Absolute positionning |
# !! Remember to replace LIGHTHOUSE_IP with your actual Nebula lighthouse external IP Address | |
# See the example config file to know what all of these options do https://github.com/slackhq/nebula/blob/master/examples/config.yml | |
pki: | |
ca: /etc/nebula/ca.crt | |
cert: /etc/nebula/host.crt | |
key: /etc/nebula/host.key | |
static_host_map: | |
"192.168.100.1": ["<LIGHTHOUSE_IP>:4242"] |
// Observe all notifications generated by the default NotificationCenter | |
NotificationCenter.default.addObserver( | |
forName: nil, object: nil, queue: nil) { notification in | |
Swift.print("Notification: \(notification.name.rawValue), Object: \(notification.object)") | |
} | |
// Observe all notifications generated by the default DistributedNotificationCenter | |
DistributedNotificationCenter.default().addObserver( | |
forName: nil, object: nil, queue: nil) { notification in | |
Swift.print("Notification: \(notification.name.rawValue), Object: \(notification.object)") |
// Don't forget to add to the project: | |
// 1. DeepLabV3 - https://developer.apple.com/machine-learning/models/ | |
// 2. CoreMLHelpers - https://github.com/hollance/CoreMLHelpers | |
enum RemoveBackroundResult { | |
case background | |
case finalImage | |
} | |
extension UIImage { |
extension NSImage { | |
/// Create a CIImage using the best representation available | |
/// | |
/// - Returns: Converted image, or nil | |
func asCIImage() -> CIImage? { | |
if let cgImage = self.asCGImage() { | |
return CIImage(cgImage: cgImage) | |
} | |
return nil | |
} |
Custom format for displaying bytes as kb
, mb
, gb
or tb
.
Response to a few places on the internet: https://productforums.google.com/forum/#!topic/docs/x_T_N-yRUYg And here: https://stackoverflow.com/questions/1533811/how-can-i-format-bytes-a-cell-in-excel-as-kb-mb-gb-etc
Here is one that I have been using:
[<1000000]0.00," KB";[<1000000000]0.00,," MB";0.00,,," GB"
<html> | |
<head> | |
<script> | |
var Module = { | |
wasmBinaryFile: "site.wasm", | |
onRuntimeInitialized: main, | |
}; | |
function run_with_ptr(vec_ptr, cb) { | |
const ptr = Module.HEAPU32[vec_ptr / 4]; |
# Include Kafka binaries in the path | |
export PATH=$PATH:/usr/hdp/current/kafka-broker/bin | |
# Create the topic | |
# Replace localhost with the hostname of node where zookeeper server is running. | |
# Replace test with your topic name | |
kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test | |
# Check if topic is created | |
kafka-topics.sh --list --zookeeper localhost:2181 |