This file contains hidden or 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
{ | |
"name": "GPU Monitoring", | |
"elements": [ | |
{ | |
"config": { | |
"defaultValue": { | |
"earliest": "-1h", | |
"latest": "now", | |
"timezone": "local" | |
} |
This file contains hidden or 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
nvidia-smi --query-gpu=timestamp,index,name,uuid,driver_version,pci.bus_id,persistence_mode,power.draw,power.limit,temperature.gpu,fan.speed,utilization.gpu,utilization.memory,utilization.encoder,utilization.decoder,memory.total,memory.used,memory.free,clocks.sm,clocks.mem --format=csv,noheader,nounits | while IFS=, read -r ts idx name uuid drv pci persist pdraw plimit temp fan ugpu umem uenc udec mtot mused mfree csm cmem; do iso_ts=$(date -d "$ts" --utc +%Y-%m-%dT%H:%M:%SZ); echo "{\"timestamp\":\"$iso_ts\",\"index\":$idx,\"name\":\"$name\",\"uuid\":\"$uuid\",\"driver_version\":\"$drv\",\"pci_bus_id\":\"$pci\",\"persistence_mode\":\"$persist\",\"power_draw\":$pdraw,\"power_limit\":$plimit,\"temperature_gpu\":$temp,\"fan_speed\":$fan,\"utilization_gpu\":$ugpu,\"utilization_memory\":$umem,\"utilization_encoder\":$uenc,\"utilization_decoder\":$udec,\"memory_total\":$mtot,\"memory_used\":$mused,\"memory_free\":$mfree,\"clocks_sm\":$csm,\"clocks_mem\":$cmem}"; done |
This file contains hidden or 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
package main | |
import ( | |
"log" | |
"sync" | |
"time" | |
) | |
func main() { | |
log.Println("start") |
This file contains hidden or 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
(require 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/") t) | |
(package-initialize) | |
;; Use Shift + <Arrow Keys> for moving between buffers | |
(windmove-default-keybindings) | |
(setq windmove-wrap-around t) | |
;; Because Shift-Up is broken on xterm |
This file contains hidden or 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
% git push | |
Counting objects: 26, done. | |
Delta compression using up to 8 threads. | |
Compressing objects: 100% (14/14), done. | |
Writing objects: 100% (15/15), 20.28 KiB, done. | |
Total 15 (delta 9), reused 0 (delta 0) | |
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/connection/hiredis.rb:23:in `connect': Timeout::Error (Timeout::Error) | |
remote: from /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:204:in `establish_connection' | |
remote: from /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:23:in `connect' | |
remote: from /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:224:in `ensure_connected' |
This file contains hidden or 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
#!/bin/bash | |
ssh-add | |
ssh $1 "mkdir -p .ssh && touch .ssh/authorized_keys && echo `ssh-add -L` >> .ssh/authorized_keys" | |
# keep this file in the PATH. like in /usr/bin. |
This file contains hidden or 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
def factorize(list, num, p) | |
while true | |
list.each_with_index { |e, i| list[i] = 0 if e!=p && e%p == 0 } | |
list.each{|e| p = e and break if e > p} | |
if num % p == 0 | |
# p num | |
return factorize(list[p..Math.sqrt(num/=p)], num, p) | |
end | |
return num if list.empty? | |
end |
This file contains hidden or 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
class Array | |
def fibselect(&block) | |
o, i, array = 0, 1, [] | |
while i < length | |
o, i = i, i+o | |
array << self[i] | |
end | |
array.compact.select &block | |
end | |
end |
This file contains hidden or 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
p [1..999].select{|e| e%3 == 0 || e%5 == 0}.inject(:+) |
This file contains hidden or 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
#"Find the greatest product of five consecutive digits in the 1000-digit number." | |
# http://projecteuler.net/problem=8 | |
big = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522\ | |
74430435576689664895044524452316173185640309871112172238311362229893423380308135336276614282806444486645238749303589072962904915604407723907138105158593079608667017242712188399879790879227492190169\ | |
97208880937766572733300105336788122023542180975125454059475224352584907711670556013604839586446706324415722155397536978179778461740649551492908625693219784686224828397224137565705605749026140797296\ | |
86524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054\ | |
4217506941658960408071984038509624554443629812309878799272442849091888458015616609791913387549920052406368991 |
NewerOlder