Skip to content

Instantly share code, notes, and snippets.

View SankaitLaroiya's full-sized avatar

Sankait Laroiya SankaitLaroiya

View GitHub Profile
SankaitLaroiya /
Created June 27, 2018 19:30
Changing timezone of a linux machine
# All the available time zones are in directory /usr/share/zoneinfo
# Choose whichever one you want and replace the path below
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
SankaitLaroiya / gethostname.js
Created March 9, 2018 21:52
(JS) Get the host name from a URL
View gethostname.js
// Code snippet taken from:
function getHostNameFromURL(url) {
if (!url) {
return null;
let hostname;
SankaitLaroiya / scale.js
Last active March 9, 2018 21:54
(JS) Scale Numbers Between a Given Range
View scale.js
// Code snippet taken from:
function scaleBetween(unscaledNum, minAllowed, maxAllowed, min, max) {
return (maxAllowed - minAllowed) * (unscaledNum - min) / (max - min) + minAllowed;
SankaitLaroiya /
Last active February 17, 2018 05:03
(Python) Speech recognition using IBM Speech to Text
#!/usr/bin/env python3
# NOTE 1: Add the username and password to your IBM Watson account below
# (More info:
# NOTE 2: this example requires PyAudio because it uses the Microphone class
# pip3 install pyaudio
# if getting an error do
# brew remove portaudio
# brew install portaudio