Skip to content

Instantly share code, notes, and snippets.

View rohitChaku's full-sized avatar

Rohit Chaku rohitChaku

  • Gujarat, India
View GitHub Profile
@payam-int
payam-int / gist:edf977c6af603fee0ce1b05da7792fe7
Last active March 25, 2025 16:18
Prometheus Node Exporter - CPU and Memory Usage

CPU Usage :

(1 - avg(irate(node_cpu_seconds_total{mode="idle"}[10m])) by (instance)) * 100

Memory Usage :

100 * (1 - ((avg_over_time(node_memory_MemFree_bytes[10m]) + avg_over_time(node_memory_Cached_bytes[10m]) + avg_over_time(node_memory_Buffers_bytes[10m])) / avg_over_time(node_memory_MemTotal_bytes[10m])))
@R3V1Z3
R3V1Z3 / vscode-snakecase-to-camelcase.md
Last active July 2, 2025 19:09
Convert all occurrences of snake_case to camelCase in VS Code. Windows/Linux walk-through here: https://youtu.be/vlHel1fN5_A

Convert snake_case to camelCase in VS Code

  • Press CTRL-H ( ⌥⌘F on Mac ).
  • Press ALT-R ( ⌥⌘R on Mac ).
  • Type _([a-zA-Z]).
  • Press TAB and type $1.
  • Press ALT-ENTER ( ⌥ENTER on Mac ).
  • Press F1 and type upper, then press ENTER.
  • Press CTRL-ALT-ENTER ( ⌥ENTER on Mac ).
@1duo
1duo / centos.install.cmake.from.source.md
Last active June 18, 2025 08:29
Install CMake on CentOS 7.

Download CMake from: https://cmake.org/download/

wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz

Compile from source and install

tar zxvf cmake-3.*
@hassansin
hassansin / request-response.go
Last active January 20, 2025 07:26
Request-response pattern over asynchronous protocol using Go channel
package main
import (
"errors"
"fmt"
"math/rand"
"net/http"
"sync"
"time"
@NEJmark
NEJmark / uao_decode.py
Last active December 9, 2021 13:14 — forked from andycjw/uao_decode.py
Big5 UAO decodeusage: just do 'import uao_decode.py'unicode_string = big5_string.decode('uao_decode')
# -*- coding: utf-8 -*-
import codecs
import struct
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
u'''
## for example:
## 1. u'築'= \u7bc9, 7bc9(16 進位) = 31689(10進位)
## 2. '築'= '\xbfv'='\xbf\x76'('v'=='\x76'), bf76(16 進位) = 49014
@g-dormoy
g-dormoy / gist:c707ebed2381f5eb08eaec93ac1d4efb
Created February 16, 2017 08:50
gitlab-ci for golang dev
image: golang:1.7
before_script:
- export GO_PROJECT_PATH="$GOPATH/src/git.int.rtblw.com/$CI_PROJECT_NAMESPACE"
- echo $GO_PROJECT_PATH
- mkdir -p $GO_PROJECT_PATH
- ln -s $(pwd) $GO_PROJECT_PATH
- export GO_PROJECT_PATH="$GO_PROJECT_PATH/$CI_PROJECT_NAME"
- echo $GO_PROJECT_PATH
- cd $GO_PROJECT_PATH
stages:
@Nydhal
Nydhal / queue.cpp
Last active November 12, 2021 04:47
Queue Class example with explanations in C++
#include <iostream>
using namespace std;
class Queue { // Class definition
private: //private members can only be accessed in the class
int queue_size;
protected: // protected members can ba accessed in derived classes
int* buffer; // pointer to first element of array
int front; // used for removing an element of array
int rear; // user for adding an element into queue
@rpherrera
rpherrera / get-aws-ecr-repositories-names.sh
Last active April 6, 2025 19:18
get aws ecr repositories names with aws cli, parsing results with jq and stripping double quotes with sed or tr
#!/bin/bash
# stripping double quotes with sed
aws ecr describe-repositories | jq '.repositories[].repositoryName' | sed s/\"//g
# stripping double quotes with tr
aws ecr describe-repositories | jq '.repositories[].repositoryName' | tr -d '"'
@Khoulaiz
Khoulaiz / gist:41b387883a208d6e914b
Last active August 30, 2024 01:05
Checking ports without telnet

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
@hmartiro
hmartiro / zeromq-vs-redis.md
Last active December 16, 2024 04:02
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements: