Skip to content

Instantly share code, notes, and snippets.

pipeline {
agent {
label "windows"
}
environment {
PYTHON_VERSION = "3.7.0"
BROWSERSTACK = credentials("browserstack")
BROWSERSTACK_USERNAME = "${env.BROWSERSTACK_USR}"
BROWSERSTACK_ACCESS_KEY = "${env.BROWSERSTACK_PSW}"
@shirish87
shirish87 / jq-jwt.sh
Created March 14, 2024 16:48
jq-jwt.sh
jq -R 'split(".") | .[:2] | map( @base64d | fromjson | if (.exp) then (. + ({ "expiry": .exp | strflocaltime("%Y-%m-%dTT%H:%M:%S %Z") })) else . end )' <<< "$1"
runtime.cc:655] Runtime aborting...
runtime.cc:655] Dumping all threads without mutator lock held
runtime.cc:655] All threads:
runtime.cc:655] DALVIK THREADS (38):
runtime.cc:655] "Binder:17466_1" prio=5 tid=14 Runnable
runtime.cc:655] | group="" sCount=0 dsCount=0 flags=0 obj=0x13501ec0 self=0x7a21018080
runtime.cc:655] | sysTid=17485 nice=0 cgrp=default sched=0/0 handle=0x784c2fbcc0
runtime.cc:655] | state=R schedstat=( 26369115 43215835 91 ) utm=2 stm=0 core=2 HZ=100
runtime.cc:655] | stack=0x784c204000-0x784c206000 stackSize=995KB
runtime.cc:655] | held mutexes= "abort lock" "mutator lock"(shared held)
EQ preset applied=0
EQ preset=Normal
EQ Normal band=0 level=300 / 1500
EQ Normal band=1 level=0 / 1500
EQ Normal band=2 level=0 / 1500
EQ Normal band=3 level=0 / 1500
EQ Normal band=4 level=300 / 1500
EQ preset=Classical
EQ Classical band=0 level=500 / 1500
EQ Classical band=1 level=300 / 1500
@shirish87
shirish87 / audiobook-split-parts.sh
Last active December 15, 2022 14:47 — forked from vi/split_by_silence.sh
Using FFmpeg to split mp3 audiobook file into mp3 parts based on audio volume level
#!/bin/bash
IN="$1"
MIN_DUR_MINS="${2:-30}"
MIN_PART_DURATION_SECS=$(($MIN_DUR_MINS * 60))
IN_PATH=`realpath "$1"`
DEFAULT_OUTDIR="$(dirname "$IN_PATH")/parts"
OUTDIR="${3:-$DEFAULT_OUTDIR}"
OUTFILE_PATTERN="${OUTDIR}/part-%03d.mp3"
import {
ClientOptions,
WritePrecision,
WriteOptions,
WritePrecisionType,
} from '@influxdata/influxdb-client/dist/options';
import TransportImpl from '@influxdata/influxdb-client/dist/impl/node/NodeHttpTransport';
import WriteApiImpl from '@influxdata/influxdb-client/dist/impl/WriteApiImpl';
import QueryApiImpl from '@influxdata/influxdb-client/dist/impl/QueryApiImpl';
import {
@shirish87
shirish87 / extract-product-list.sh
Created April 15, 2020 14:41
Scripts to extract product list (for organizing pooled orders to StarBazaar during COVID-19 lockdown)
#!/bin/bash -e
# Usage: ./extract-product-list.sh foodgrains.json > foodgrains.txt
jq -j '.ProductList[] | .product[] | .Name, " (Price: ", .Price, ", Offer Price: ", .sale_price, ")\n"' $@
#!/bin/bash -e
dest="$(date '+%Y-%m-%d')-snapshot"
container="${1:-influxdb-1}"
db="${2:-comp_prices}"
destpath="/tmp/${dest}"
destfile="/tmp/${dest}.tgz"
docker exec -it $container influxd backup -portable -database $db "$destpath"
@shirish87
shirish87 / worker.module.ts
Created February 15, 2020 20:46
Propagate NATS connection error to microservice init
import { Module, INestMicroservice, Logger } from '@nestjs/common';
import { WorkerService } from './worker.service';
import { WorkerController } from './worker.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { NestFactory } from '@nestjs/core';
import { Transport } from '@nestjs/common/enums/transport.enum';
@Module({
imports: [TypeOrmModule.forRoot()],
providers: [WorkerService],
import { Test, TestingModule } from '@nestjs/testing';
import { OrganisationTariffService } from './organisation-tariff.service';
import { getRepositoryToken } from '@nestjs/typeorm';
import { OrganisationTariff } from './organisation-tariff.entity';
import { Repository } from 'typeorm';
// @ts-ignore
export const repositoryMockFactory: () => MockType<Repository<OrganisationTariff>> = jest.fn(() => ({
manager: { connection: { close: () => Promise.resolve() } },
findOneOrFail: jest.fn(entity => entity),