Skip to content

Instantly share code, notes, and snippets.

View nmicic's full-sized avatar
😀
I may be slow to respond.

Nenad Micic nmicic

😀
I may be slow to respond.
View GitHub Profile
@nmicic
nmicic / microgpt.c
Last active March 23, 2026 16:43 — forked from karpathy/microgpt.py
microgpt.c — sub-20ms GPT training and inference in pure C
/* Copyright (c) 2026 Nenad Mićić <nenad@micic.be> https://be.linkedin.com/in/nenadmicic
* SPDX-License-Identifier: Apache-2.0
*
* microgpt.c — Minimal GPT training and inference in 655 lines of pure C.
* Hand-written forward and backward pass, two-phase gradient accumulation.
* Trains a 1-layer, 4-head, 4192-parameter character-level transformer.
*
* Inspired by Andrej Karpathy's microgpt.py (200 lines of Python):
* https://gist.github.com/karpathy/8627fe009c40f57531cb18360106ce95
*
@nmicic
nmicic / 0 ssl.sh
Last active January 31, 2025 12:44
Single liners for monitoring SSL DI-NET and pools:
date;cli show card table | grep "Service Function" | tr -d : | awk '{print exec="ssh card"$1"-cpu0 /usr/bin64/iftask_dump_stats -d ";print(exec);system(exec);print "===END==="}' | grep -vE '\s+0\s+0\s+0\s+0'
@nmicic
nmicic / extract_egtpc_peers.awk
Last active December 19, 2024 07:58
get egptc peers list from SSD or show egtpc peer output
#!/usr/bin/awk -f
#Use: chmod +x ./extract_egtpc_peers.awk;
# cat SSD.txt | ./extract_egtpc_peers.awk
# Example to use on multiple SSD's:
# cat SSD1.txt | ./extract_egtpc_peers.awk > peers1.txt
# cat SSD2.txt | ./extract_egtpc_peers.awk > peers2.txt
# cat SSD3.txt | ./extract_egtpc_peers.awk > peers3.txt
# then agregate outputs into one:
# cat peers*.txt | sort | uniq > all.txt
# -> if SSD1,2,3 are from different nodes, then all.txt will have agregated view from all.
@nmicic
nmicic / 0 README.md
Last active November 27, 2024 11:47
RJIO MOP 698327065

First execute

  1. prior MOP commands
  2. debug shell card4 ipsecmgr task kill
  3. if no progress then excute: dcardmgr task kill ( NOTE: here execute again 2 after)
  4. after MOP commands
  5. if no change then reboot card 4 ( not migration )
  6. run one more time after MOP commands ( this has to be done anyways )
  7. if there are any issue alert the TAC
@nmicic
nmicic / crypto_chip_detect.sh
Created October 3, 2023 22:19
crypto_chip_detect.sh
#!/bin/sh
# To run:
#
# chmod +x crypto_chip_detect.sh;
# ./crypto_chip_detect.sh support_summary
#
# In short script check Alloc-Free for crypto counters which will be very low for working cards - usually less then 100 or more around 10.
# Note threshold is set to 3000, in some corener cases during very high load may go to this value, but will go back in second back to low value.
# BUT, if you see 4 lines: Issue deteceted delta for same card then it is 100% crypto chip issue.
# This threshold is assumed as we are little bit bellow 4K buffers. In 21.28.mX buffers are increased to 4k. In older version this could be close to 1K.
@nmicic
nmicic / UcadCryptoMig_script.sh
Last active December 14, 2023 10:59
UcadCryptoMig_script.sh
#!/bin/bash
### Ver 5.0 # 14th Dec 2023
###Contact: nmicic@cisco.com
###
### NOTE: Please copy/paste script from begin #!/bin/bash to the ###END
### NOTE: Please copy/paste script from begin #!/bin/bash to the ###END
### NOTE: Please copy/paste script from begin #!/bin/bash to the ###END
read -r -d '' HELP_README << README_BEGIN_END
# get to debug shell after cli test-commands password ...
To run:
@nmicic
nmicic / README.md
Last active April 7, 2023 17:27
chatgpt
nanoGPT
llama.ccp
gpt4all
@nmicic
nmicic / detect_from_MIO_debug_shell.sh
Last active September 9, 2022 10:10
To_detect_which_card_cpu_has_crypto_chip_hang
#!/bin/bash
echo "Impacted card is one where you see the line: ERROR: Qat is not responding. Please restart the device"
ping bcast -c 2 -w 0.2 -b >& /dev/null
IpNeighShowReach=( $( ip neigh show | grep 172.16 | grep REACHABLE | awk '{print $1}' | sort -n ))
i=0;for IP in "${IpNeighShowReach[@]}";do i=$(( $i + 1 )); IPX[$i]=$IP;done;iLAST=$i;
for ((i=1;i<=$iLAST;i++)); do
IP=${IPX[$i]};
echo === $IP ===
grep $IP" " /etc/hosts
ssh $IP 'grep -e "ERROR" -e "Qat is not responding" -e "Please restart the device" /proc/icp*/qat* /proc/icp*/heartbeat*'
@nmicic
nmicic / disable
Last active September 8, 2022 19:56
Automatic collection of Sessmgr core when 1st symptom event occur ([sessmgr 10039 error] ... sessmgr_med.c:24635] ...MED RX SHORT PDU from MED rxlen 0 iplen 0. MED info: from BIA(s/m/p) 3/2/65533 sBia=0302fffd dBia=0303c0b4. Len dump 0 0
#NOTE: This just generate output. You have to paste back this into CLI and configure it!
cli test-commands password .....
debug shell
cli show task table facility sessmgr all | grep sessmgr | awk 'BEGIN{print "configure"} {if ($3<5000){print "no logging enable-debug facility sessmgr instance "$3 }} END{print "exit"}'
exit
#NOTE: This just generate output. You have to paste back this into CLI and configure it!
@nmicic
nmicic / ring_buffer.sh
Last active September 8, 2022 08:52
ring_buffer
#!/bin/bash
cat << DONT_REMOVE_THIS_LINE_BEGIN_END_M > /tmp/Intel_ring_dump.tgz.base64
H4sIAAAAAAACA+xcDXRTVZ5/SVsaoCYRqlZReWgrRSE0bSnho9iUFF7Z4jBQ1Bmo
aUhSyJAvk5dSRnbs2bSuj1in7jmuHs4cl9nZ4zozu37M6Aw6zrS1QMGPGWTOOMwy
syKKJBaxrHxUEbL//333tTeveSi7jmf32FuSe+/v/r/u/37mvvuoD4pevzPiC250
emKB8FzurxDKIMyfN4/EENQxSVsrK8qqKsqryudZuTJredX8eRw/769hjDrEoqIr
wvNcJBQSL0X3eeX/T0O9qv0DAU+k1bI59GXquHT7l1dY58ntX2Eth69KaP/KCoD4
sq/CAV/z9r+/rmGZXqcbyeu4JZwuC53NPJquod9F3FVcLqQK4ZMDn+V3rOUerpvK
hZ4dmvoc//bhla9ssaz/4N5mVs5aQTomxE+YBalpqEHyDicRFKRzDYknuzGV+IZZ
SLQaGhLLSxuko8KsU4Sgs1fqjxVIhxoS3mEh0TS0vx8LB/ZimbVX6DtaIAwMYIZQ