Skip to content

Instantly share code, notes, and snippets.

View hyfather's full-sized avatar

Nikhil Mungel hyfather

View GitHub Profile
@hyfather
hyfather / gpu.json
Created July 25, 2025 20:21
GPU Monitoring with Cribl: Cribl Search Examples
{
"name": "GPU Monitoring",
"elements": [
{
"config": {
"defaultValue": {
"earliest": "-1h",
"latest": "now",
"timezone": "local"
}
@hyfather
hyfather / nvidia-smi.sh
Created July 25, 2025 20:20
GPU Monitoring with Cribl: nvidia-smi Command & Cribl Search Examples
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
@hyfather
hyfather / pipeline.go
Created April 6, 2018 23:13
Go Pipelines
package main
import (
"log"
"sync"
"time"
)
func main() {
log.Println("start")
@hyfather
hyfather / init.el
Last active August 29, 2015 14:01
my_emacs_init.el
(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
@hyfather
hyfather / github_stacktrace
Created June 20, 2012 11:17
github post receive hook stacktrace
% 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'
@hyfather
hyfather / ssh-copy-id
Created December 16, 2011 08:05
ssh-copy-id
#!/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.
@hyfather
hyfather / euler_three.rb
Created November 14, 2011 06:20
My solution to problem #3 on projecteuler.net
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
@hyfather
hyfather / euler_two.rb
Created November 13, 2011 20:35
My solution to problem #2 on projecteuler.net
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
@hyfather
hyfather / euler_one.rb
Created November 13, 2011 20:34
My solution to problem #1 on projecteuler.net
p [1..999].select{|e| e%3 == 0 || e%5 == 0}.inject(:+)
@hyfather
hyfather / euler_eight.rb
Created November 9, 2011 04:49
My solution to problem #8 on projecteuler.net
#"Find the greatest product of five consecutive digits in the 1000-digit number."
# http://projecteuler.net/problem=8
big = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522\
74430435576689664895044524452316173185640309871112172238311362229893423380308135336276614282806444486645238749303589072962904915604407723907138105158593079608667017242712188399879790879227492190169\
97208880937766572733300105336788122023542180975125454059475224352584907711670556013604839586446706324415722155397536978179778461740649551492908625693219784686224828397224137565705605749026140797296\
86524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054\
4217506941658960408071984038509624554443629812309878799272442849091888458015616609791913387549920052406368991