Skip to content

Instantly share code, notes, and snippets.

View navinthenapster's full-sized avatar
💭
I may be slow to respond.

Navin Infant Raj navinthenapster

💭
I may be slow to respond.
View GitHub Profile
@navinthenapster
navinthenapster / ffmpeg.md
Created February 27, 2019 05:59 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@navinthenapster
navinthenapster / SoundDevice_Playback.py
Created May 8, 2019 11:52
Live streaming the speech input and saving the output file
import sounddevice as sd
duration = 5 # seconds
import wave
from scipy.io import wavfile
def writeWavFile(frames,width=2L,fileName="test.wav"):
#writing the wave file
wf = wave.open(fileName, 'wb')
wf.setnchannels(1)
wf.setsampwidth(2L)
@navinthenapster
navinthenapster / Loader.py
Created May 8, 2019 11:52
Loading script for printing the spinner in console
import sys
import time
def spinning_cursor():
while True:
for cursor in '|/-\\':
yield cursor
spinner = spinning_cursor()
for _ in range(50):
@navinthenapster
navinthenapster / Signal.py
Created May 8, 2019 11:54
Creating the signal in the python program for inter process communication
from pydispatch import dispatcher
SIGNAL = 'my-first-signal'
def handle_event( **kwargs ):
"""Simple event handler"""
print 'Signal was sent by', kwargs['message']
dispatcher.connect( handle_event, signal=SIGNAL, sender=dispatcher.Any )
first_sender = "sender"
second_sender = "sender"
@navinthenapster
navinthenapster / dateformatter.py
Created May 8, 2019 11:56
Date Format utils function Included the regular expression and the datetime utils function.
import re
from datetime import datetime, timedelta
datas=["01:48PM","Yesterday 06:31PM", "04/08 05:25PM","11/07/2018 05:12PM"]
def date_parse(data):
pattern1 = "(\d{2}):(\d{2})([AaPp][Mm])"
@navinthenapster
navinthenapster / responsive_view.html
Created March 12, 2020 11:51
Responsive Web Design Code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navin - My Portifolo | Developer </title>
</head>
<style>
#web, #tablet, #mobile { display: none;}
@navinthenapster
navinthenapster / README_cadence.txt
Last active March 30, 2021 08:55
CADENCE tools README
================================================================================================================================================================================================================
_ ____ ___ ____ _ _ ____ ____ _ ____ _____ _ _ ____ _____
/ \ / ___|_ _/ ___| | / \ | __ ) / ___| / \ | _ \| ____| \ | |/ ___| ____|
/ _ \ \___ \| | | | | / _ \ | _ \ _____| | / _ \ | | | | _| | \| | | | _|
/ ___ \ ___) | | |___| |___ / ___ \| |_) |_____| |___ / ___ \| |_| | |___| |\ | |___| |___
/_/ \_\____/___\____|_____/_/ \_\____/ \____/_/ \_\____/|_____|_| \_|\____|_____|
===================================================================================================================================================================================================================
Snippet by Navin TheNapster
@navinthenapster
navinthenapster / GPU_instanation_guide.md
Last active August 25, 2021 11:53
To configure and connect GPU drivers to tensorflow

https://medium.com/@medasuryatej/install-tensorflow-gpu-2-0-f4e215438199

for libcupti problem

I have encountered this problem before. When you use CUDA 8.0,the file cupti64_80.dll lies in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64. I just fixed the problem by copying the dll into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin, and the file cupti.lib in the same location into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64.

On Nvidia Control Panel, there is a Developer-Manage GPU Performance Counters section. Default toggle is to limit access to GPU preformance counters to admin users only. But you must select 'Allow acces to the GPU prformance counters to all users'. Once toggled, access permissions to the cupti dll are resolved.

@navinthenapster
navinthenapster / show_wifi_password.bat
Created August 23, 2021 15:33
To see saved wifi password in windows
# Windows
netsh wlan show profiles
netsh wlan show profile name=<wifi_name_ssid> key=clear
https://www.online-tech-tips.com/computer-tips/view-saved-wifi-passwords-windows/
#ubuntu
sudo cat /etc/NetworkManager/system-connections/<wiFi_name_ssid>.nmconnection
https://itsfoss.com/how-to-find-saved-wireless-wifi-passwords-ubuntu/
@navinthenapster
navinthenapster / pandas_trick.py
Last active August 23, 2021 16:13
Tips and Tricks for pandas operation
# to read data
df_data=pd.read_csv("csvfile.csv")
#replace value in columns
df_data = df_data.replace({
'colname': {
'value': 'new_value'
}
})