Skip to content

Instantly share code, notes, and snippets.

View gangsta's full-sized avatar
😎

Karen Harutyunyan gangsta

😎
View GitHub Profile
@gangsta
gangsta / jq-examples.md
Last active April 15, 2024 21:48
Mastering JSON Parsing with jq: A Comprehensive Guide for Time and Date Range Filters in API Data Processing with Bash

Welcome! If you're here, chances are you've made an API call, and it's returning JSON data that you want to parse using a jq script. Let's work through it together.

Whether you're a seasoned developer or just starting out, this blog is your go-to resource for mastering the art of JSON parsing with jq. Specifically, if you're searching for insights on how to efficiently filter and process date ranges, you've come to the right place.

Explore topics such as 'jq filter date range', 'jq how to select date range', 'jq filter selected date range', "How to select a date range from a JSON string by using jq", "jq between two dates" and more. Whether you're looking to filter records in the future, select last week's records, or retrieve emails from a specific timeframe using jq, this blog provides a comprehensive guide to help you navigate the intricacies of JSON parsing with precision.

Let's dive into the world of jq and together, master the art of effortlessly filtering and selecting date ranges!

JSON example

@gangsta
gangsta / hashicorp_vault_basics.md
Last active February 15, 2023 21:19
Get Started with HashiCorp Vault Presentation Demo Document

Setup

# Install
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update -y
sudo apt-get install vault -y

# Start
@gangsta
gangsta / fedora_black_sreenshare.md
Created November 11, 2022 11:47
Fedora Screen Share - black screen when sharing Wayland / Gnome

Google Chrome

Wayland’s way of screenshare is improving, you can

  • Navigate to page chrome://flags
  • Search for WebRTC
  • flip that switch to Enabled
  • Restart the browser (Chrome will auto ask, if not manually restart the browser)
@gangsta
gangsta / fedora_35_mic_no_sound.md
Last active December 13, 2021 12:48
Fedora 35 Mic issue, No sound , Missing audio on Lenovo ThinkPad t14s | 490s

Common error.

fedora pulseaudio[2352]: Failed to create sink input: sink is suspended.

Solution

systemctl --user enable --now wireplumber
@gangsta
gangsta / linux_commands.md
Last active March 23, 2023 14:54
Daily Linux Commands Cheat Sheet

Delete Github branches except main or master

git branch | grep -v "main" | xargs git branch -D

Useful Commands list

CPU

@gangsta
gangsta / argo-helm.md
Created January 11, 2021 10:52
Kubernetes argo tunnel setup via helm charts

Error

Error: validation failed: unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1"

Temporary Solution

Kubernetes 1.16+

git clone https://github.com/cloudflare/helm-charts.git
cd helm-charts/charts/
@gangsta
gangsta / fedora31.md
Created February 6, 2020 08:55
How to disable fedora 31 problem reporter

How to Disable Fedora 31 problem reporter

/sbin/service abrtd stop
chkconfig abrtd off
@gangsta
gangsta / remove-vagrant.md
Last active January 16, 2020 10:13
How to Remove Vagrant domain from Fedora 30,31

If you removed Vagrantfile but not Vagrant host. you'll get following error:

Name 'vagrantbox_default' of domain about to create is already taken. Please try to run 'vagrant up' command again.

For Fedora users, or force undefine you need following.

To install virsh.

@gangsta
gangsta / openvpn_fedora30.md
Last active May 25, 2024 21:30
Fedora 30 Connect to OpenVPN

Install Openvpn

sudo dnf install openvpn

Configure Path

mv myopenvpconfig /etc/openvpn/client/
@gangsta
gangsta / Prometheus node_exporter Metrics Data Size and Time Count
Last active April 10, 2019 15:21
Bash Script to Fetching Node_Exporter Data Size and Time for Consuming Metrics
#!/usr/bin/env bash
set -e
bytesToHuman() {
b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}iB)
while ((b > 1024)); do
d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))"
b=$((b / 1024))
let s++
done