Skip to content

Instantly share code, notes, and snippets.

import subprocess
import time
def automate_cli_input(cli_command, input_values):
# Start the CLI subprocess
cli_process = subprocess.Popen(cli_command.split(), stdin=subprocess.PIPE,
stdout=subprocess.PIPE, universal_newlines=True)
# Iterate over the expected input prompts
for prompt, value in input_values.items():
import shutil
import os
import json
from PIL import Image
def copy_from_to(file_path_from, file_path_to):
shutil.copy(file_path_from, file_path_to)
def copy_subset_of_kitti(input_folder_path, output_folder_path, idx_begin='000000', idx_end='001000'):
# Improvements:
import roboflow_datasets as roboflow
import os
import shutil
def make_dir(new_dir_path):
if not os.path.exists(new_dir_path):
os.makedirs(new_dir_path)
print(f'{new_dir_path} created')
def copy_from_to(file_path_from, file_path_to):
@jogam5
jogam5 / subprocess_tao_nvidia.py
Created December 19, 2022 05:39
subprocesses python library
THIS WORKS!
import subprocess
cmd = ['tao', 'yolo_v4_tiny', 'export', '-m',
'/workspace/tao-experiments/yolo_v4_tiny/experiment_dir_retrain/weights/yolov4_cspdarknet_tiny_epoch_005.tlt',
'-k', 'YOUR_KEY',
'-e', '/workspace/tao-experiments/yolo_v4_tiny/specs/yolo_v4_tiny_retrain_kitti.txt',
'-o', '/workspace/tao-experiments/yolo_v4_tiny/export/yolov4_cspdarknet_tiny_epoch_005.etlt',
'--data_type', 'fp32',
'--gen_ds_config']
# For the best DCGAN generator
# 1. covid small
# 2. rsna_10
# 3. rsna_50
noise = np.random.normal(0, 1, (100, 128))
gen_sample = generator.predict([noise, label]) # e.g. label is 0 or 1 in RSNA
# gen_sample in keras outputs (100, 64, 64, 3)
# e.g. for rsna_10 i need two vectors (100, 64, 64, 3), one for each lass
@jogam5
jogam5 / wwmse_v1.txt
Last active December 8, 2021 05:36
wwmse example
# Note: 1 and 2 are simplifications to be more clear
# 1. Generate distribution: simplification
data_from_distribution = generate_rayleigh_CSI(parameter_1, parameter_2, parameter_3, ...)
# 2 Loop over data to compute wwmse: simplification
for sample in range(data_from_distribution):
wwmse = WMMSE(number_of_transceivers, sample, max_power_budget, noise)
# ==Parameters==:
#
@jogam5
jogam5 / InvertedIndex.java
Created October 22, 2021 01:35
Inverted Index using MapReduce
package my.index;
import java.io.*;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.*;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
@jogam5
jogam5 / Grep.java
Created October 22, 2021 01:29
Grep in MapReduce
package my.midterm;
/*
'Overview' section provides a concise high level summary of Hadoop - MapReduce:
https://hadoop.apache.org/docs/r1.2.1/mapred_tutorial.html
*/
import java.io.*;
import java.util.*;
import org.apache.hadoop.fs.Path;
Autodials (Github examples)
https://github.com/sloan58/twilio-autodialer
https://github.com/cristeab/autodialer
Build IVR with Lex
https://cogint.ai/conversational-ivr-with-amazons-lex-and-connect/
Amazon Lex Developer Resources
https://aws.amazon.com/lex/resources/
https://github.com/awslabs/aws-lex-browser-audio-capture
@jogam5
jogam5 / Docker_GO_Options.txt
Last active July 21, 2020 19:21
Create a Dockerfile for GO
# Option 1
go mod init
go build
# Option 2
export GO111MODULE=on
go mod init
go mod download
go mod vendor