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 ruby | |
$stdout.sync = true | |
cpu_last = {} | |
cpu_last_sum = {} | |
loop do | |
cpus = IO.readlines('/proc/stat').select { |line| line.start_with?('cpu') } |
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
function rotate(srcBase64, degrees, callback) { | |
const canvas = document.createElement('canvas'); | |
const ctx = canvas.getContext('2d'); | |
const image = new Image(); | |
image.onload = function () { | |
canvas.width = degrees % 180 === 0 ? image.width : image.height; | |
canvas.height = degrees % 180 === 0 ? image.height : image.width; | |
ctx.translate(canvas.width / 2, canvas.height / 2); |