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 / 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 / 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 / client.html
Created February 20, 2019 13:25 — forked from ericremoreynolds/client.html
Flask-socket.io emit to specific clients
<html>
<body>
<h1>I feel lonely</h1>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
socket.emit('connected');
@navinthenapster
navinthenapster / gist:d1a9da0c15df725c5a2bc117a43ffb07
Created November 29, 2018 12:13
Configuring behind company network proxy
https://www.jhipster.tech/configuring-a-corporate-proxy/
@navinthenapster
navinthenapster / USB Logs
Last active December 26, 2022 18:30
To remove the USB Logs files in Ubuntu
# Ubuntu
dmesg
sudo dmesg --clear
sudo cat /var/log/kern.log | grep usb
sudo rm -rf /var/log/kern*
#old log files
sudo zcat /var/log/kern.log.2.gz | grep usb
sudo cat /var/log/syslog | grep usb
@navinthenapster
navinthenapster / jupter_python3.sh
Created September 12, 2018 11:02
Installs the Python3 to the jupyter notebook
python3 -m pip install ipykernel
python3 -m ipykernel install --user
@navinthenapster
navinthenapster / import_certf_terminal.sh
Last active March 21, 2019 09:35
To import Proxy Certficate of an organization and to access website by importing authorized certifcates
sudo openssl x509 -inform DER -in certificate.cer -out certificate.crt
sudo mv certificate.crt /usr/share/ca-certificates/
sudo mv certificate.crt /usr/local/share/ca-certificates/
cd /usr/share/ca-certificates
sudo chmod 644 certificate.crt
sudo dpkg-reconfigure ca-certificates
@navinthenapster
navinthenapster / SessionManagementScriplet.jsp
Last active January 17, 2018 09:50
Session redirect by navin
<%
response.setHeader("Cache-Control","no-cache,no-store,must-revalidate");//HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
if(session==null || session.getAttribute("user")==null){
response.sendRedirect(request.getContextPath()+"/MainController");
return;
}
%>
@navinthenapster
navinthenapster / SequenceTrigger.sql
Last active January 6, 2018 05:40
Oracle Sql . proper Create table which can take default timestamp, condition and triggers a sequences
CREATE SEQUENCE notify_seq
INCREMENT BY 1
NOCACHE
NOCYCLE;
DROP SEQUENCE notify_seq
CREATE TABLE NOTIFICATIONS(
@navinthenapster
navinthenapster / JSP_ajax_to_controller.jsp
Created January 1, 2018 08:35
Perform Ajax Call from JSP pages to controller or servlet in request.getParameter and return a JSON object from controller.
$scope.sendmessage= function(from,to,msg,status){
$.ajax({
type: 'POST',
url: '<%=request.getContextPath()%>/MainController',
data: {
"from" : from,
"to" : to,
"message" : msg,
"action": "sendmsg",