Skip to content

Instantly share code, notes, and snippets.

View jcopps's full-sized avatar
🥁
Figuring out

Jeffry copps jcopps

🥁
Figuring out
View GitHub Profile
@jcopps
jcopps / test_ram_cpu_utilisation
Created May 21, 2024 11:41
Collect RAM, CPU, Swap and Secondary Storage Utilisation
"""
Dependency: psutil
pip3 install psutil
"""
import psutil
import time
import json
from datetime import datetime
def get_system_utilization():
@jcopps
jcopps / Black formatting
Created April 21, 2023 07:22
Black formatting
black() { docker run -v $(pwd):/code jbbarth/black $*; }
@jcopps
jcopps / wav_to_pcm.sh
Created February 11, 2023 07:18
Convert wav to PCM - 16K
for file in ./*; do
[ -f "$file" ] || continue
ffmpeg -i "$file" -f s16le -ar 16000 -acodec pcm_s16le "$file".raw
done
@jcopps
jcopps / Install Python3_9_7
Last active November 14, 2022 05:51
Install python3.9.7 and pip
sudo apt update
sudo apt install build-essential libncurses5-dev zlib1g-dev libnss3-dev libgdbm-dev libssl-dev libsqlite3-dev libffi-dev libreadline-dev curl libbz2-dev
sudo wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
tar -xvf Python-3.9.7.tgz
cd Python-3.9.7
./configure --enable-optimizations
@jcopps
jcopps / Debug a docker-compose service
Created October 6, 2021 11:34
How to debug a docker-compose service
version: '3.1'
services:
service_a:
image: "fat_image"
ports:
- "6382:6382"
volumes:
- /home/dir1:/home/dirA
- /home/dir2:/home/dirB
@jcopps
jcopps / README.md
Created October 4, 2021 14:47 — forked from joyrexus/README.md
Convert csv to json

Convert a CSV (comma-separated value) file into JSON.

Usage

csv2json.py data.csv > data.json
@jcopps
jcopps / curl quick load test
Created June 7, 2021 09:49
Parallelize a http request for quick load test - CURL
"""Curl Quick Load Test
P10 - 10 indicates 10 parallel instances at once.
200 - Total number of requests
"""
seq 1 200 | xargs -n1 -P10 curl "http://github.com/jcopps"
@jcopps
jcopps / accept all licenses - android on windows
Last active August 9, 2020 06:44
Accept licenses in Android - development
Location of the sdkmanager
C:\Users\IP510\AppData\Local\Android\Sdk\tools\bin>sdkmanager.bat --licenses
---------------------------------------
Accept? (y/N): y
All SDK package licenses accepted
@jcopps
jcopps / make_utf_8_json.py
Created July 12, 2020 13:41
Python2.7 Make UTF-8 encoded JSON out of unicode(escaped)
import argparse
import codecs
import json
def make_utf_8_json(input_file, output_file):
content = json.loads(open(input_file, 'r').read())
cc = json.dumps(content, indent=2, sort_keys=True, ensure_ascii=False)
file = codecs.open(output_file, "w", "utf-8")
file.write(cc)
@jcopps
jcopps / docker-address-already-in-use
Created June 6, 2020 04:01
Docker - Possible workaround for address already in use
docker stop $(docker ps -a -q)
docker ps # again to make sure containers is off
sudo lsof -i tcp:2049 # now you get and list of process running and using 2049 port find and copy PID
sudo kill -9 yout_PID
https://stackoverflow.com/questions/55535967/error-starting-userland-proxy-listen-tcp-0-0-0-02049-bind-address-already-in