Skip to content

Instantly share code, notes, and snippets.

View satishgunjal's full-sized avatar
💭
Analytics | CX Architect | Conversational AI | Chatbots | Machine Learning

Satish Gunjal satishgunjal

💭
Analytics | CX Architect | Conversational AI | Chatbots | Machine Learning
View GitHub Profile
@satishgunjal
satishgunjal / wifissid.py
Created October 14, 2018 07:20
Get connected wifi SSID using python on Raspberry pi
import subprocess
try:
output = subprocess.check_output(['sudo', 'iwgetid'])
print("Connected Wifi SSID: " + output.split('"')[1])
except Exception, e:
print e
@satishgunjal
satishgunjal / How to modify a python script started from from rc.local (Raspberry Pi)
Created October 26, 2018 11:21
How to modify a python script started from from rc.local (Raspberry Pi)
To modify a python script started from from rc.local follow below steps.
1. Login using putty
2. ps aux | grep 'the-name-of-your-progam' (The number in the second column is the pid. Use that pid to send the process a termination signal)
3. kill -TERM [put-your-pid-here]
4. Now check again >> ps aux | grep 'the-name-of-your-progam'
5. If program is stopped now modify the program and test it before adding to rc.local
@satishgunjal
satishgunjal / gist:b94a52ddcbd105d13783e0b5ff36c527
Last active January 30, 2019 14:55
Relay board with high level/ low level trigger selection
Most relay boards are 'ACTIVE LOW' which means: 0 or LOW (0V) = Relay ON, 1 or HIGH (3V3) = Relay OFF.
Some relay board have high and low level trigger mode selection. We can use jumper pin to select the mode the mode.
If low level level trigger mode is selected then Relay on will occure for control signal 0 / false / ground
If high level trigger mode is selected then Relay on will occure for control signal 1 / true / 3V3/ Vcc or Vdd
Ref. https://robu.in/product/songle-single-channel-5v-30a-relay-module-power-failure-relay/
Above 5V 30A relay module has trigger mode selection. I have tested it with Low level trigger mode only.
@satishgunjal
satishgunjal / Optocoupler with Raspberry Pi GPIO.txt
Last active January 11, 2019 09:27
Optocoupler with Raspberry Pi GPIO
Using optocoupler from Raspberry pi GPIO to control the single channel relay board(5v,30A).
Optocoupler will protect the Raspberry PI from any back EMF from inductive load like water pump, Cooler or exhaust fans.
@satishgunjal
satishgunjal / gist:ad1217035bab9e1b19ba5ec6958efe7b
Created April 12, 2019 03:40
Add/remove proxy from Node.js
## Add proxy to node.js
npm config set https-proxy http://165.225.104.34
## Remove proxy from node.js
npm config delete proxy
@satishgunjal
satishgunjal / Readme.txt
Created June 13, 2019 11:03
Setup Github on Visual Studio Code
VS Code ships with a Git source control manager (SCM) extension.
But to use it with GitHub public/private repository please install Git on PC. Make sure to install the latest version of Git.
Go to 'https://github.com/' and create new repository for your project. e.g. gitTest
Now click on 'Clone or Download' and copy the url .e.g. https://github.com/satishgunjal/gitTest.git
Now open the terminal from VS Code and go to the location where you want to create this project directoty.
e.g. terminal path:> C:\Users\satish.gunjal\Google Drive\My Projects\Node.js\Workspace
'gitTest' Project folder will be created under 'Workspace' folder in file system
Now select Terminal Window and type:
git config --global user.name <github userID>
git clone <URL from github link copied earlier> >> this will create the 'gitTest' folder under 'Workspace' folder
@satishgunjal
satishgunjal / PM2 Startup on Windows (Node.js)
Last active December 4, 2019 11:04
PM2 Startup on Windows (Node.js)
Ref. https://blog.cloudboost.io/nodejs-pm2-startup-on-windows-db0906328d75
In above document Ref Section : [1b]> PM2 save
This section explains how to configure one application and save the configurations.
But if we run 'pm2 save' cmd it will override the previous configurations.
In order to start multiple applications together load all the applications using command 'pm2 reload ecosystem.config.js --env=production'
and then run 'pm2 save' command at the end. It takes a snapshot of currently running Node applications.
We can then restore these applications using 'pm2 resurrect'. Same command will be called during windows reboot.
@satishgunjal
satishgunjal / npm pack
Created November 21, 2019 20:18
How to transfer nodejs project supporting packages/libraries if internet not working on host PC
1. Run below command on terminal from where you want to copy the packeges or supprting files
"npm pack"
for more details about this command ref. https://docs.npmjs.com/cli/pack.html
2. Now copy the entire source code folder icluding 'node_modules' on host PC
3. And run below command from host PC terminal 'npm install <name>-<version>.tgz'. Here name is from step 1
4. Now your code should work on host PC.
5. In case any error change the project name in 'package.json' on host PC.
@satishgunjal
satishgunjal / Delete repository from GitKraken
Created March 7, 2020 13:11
How to delete repository from GitKraken
1. Go to C:\Users\<my_username>\AppData\Roaming and locate the .gitkraken folder
2. Inside this folder you can find a localRepoCache file.
3. Remove the entries that areunwanted/ duplicated, and restart the Gitkraken.
@satishgunjal
satishgunjal / gist:4f02d793d1f7576e995af30b31e9ebc2
Created October 17, 2020 07:25
Versions of Imported Libraries
import pkg_resources
import types
def get_imports():
for name, val in globals().items():
if isinstance(val, types.ModuleType):
name = val.__name__.split(".")[0]
elif isinstance(val, type):
name = val.__module__.split(".")[0]