Skip to content

Instantly share code, notes, and snippets.

View sumanssaurabh's full-sized avatar
🏠
Working from home

Suman Saurabh sumanssaurabh

🏠
Working from home
View GitHub Profile
@sumanssaurabh
sumanssaurabh / Java cheatsheet.md
Created March 31, 2019 22:43 — forked from Adria87/Java cheatsheet.md
[Java cheatsheet] #java
Operation Code
New List List<Integer> x = new ArrayList<Integer>();
Copy List List<Integer> x = new ArrayList<Integer>(y);
Add an element to the List x.add(element)
Get an elemenet from the List x.get(index)
Clear the list x.clear()
New HashMap HashMap<Integer, String> x = new HashMap<Integer, String>();
Add element to the map x.put(key, value)
Get an element from the map x.get(key)
@sumanssaurabh
sumanssaurabh / bobp-python.md
Created March 31, 2019 22:41 — forked from SicHistory/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@sumanssaurabh
sumanssaurabh / readme.md
Created March 31, 2019 22:36 — forked from ionurboz/readme.md
Vanilla JS equivalents of jQuery methods

jQuery vs. JavaScript

Events

// jQuery
$(document).ready(function() {
  // code
})
# Python v3.4.2 console based script
# Set Raspberry Pi GPIO ports Low depending on user input
# User enters number between 0 and 15, GPIO ports 22, 23, 24 & 25
# are set as BCD representations of the decimal input.
# GPIO ports are weighted 0, 2, 4, 8 [GPIO 22, 23, 24, 25]
# Number 99 entered quits the script
# GPIO ports connect to AD8-11 ports on HT12E encoder chip
# user input is BCD coded & used to set AD8-11 ports
# GPIO port 17 is used to send trigger pulse to activate the HT12E for 1 complete cycle
@sumanssaurabh
sumanssaurabh / rpi_conf.sh
Created March 31, 2019 22:21
rpi configuration
#!/bin/bash
#vcgencmd measure_volts <id>
#Shows voltage. id can be one of core, sdram_c, sdram_i, sdram_p, and defaults to core if not specified
for id in core sdram_c sdram_i sdram_p ; do \
echo -e "$id:\t$(vcgencmd measure_volts $id)" ; \
done
#Shows core temperature of BCM2835 SoC.
vcgencmd measure_temp
#or
@sumanssaurabh
sumanssaurabh / rfcomm.service
Last active March 31, 2019 22:25
RFCOMM service with job control, ioctl for rpi 3b/b+ ,serial line comm over bluetooth
[Unit]
Description=RFCOMM service
After=bluetooth.service
Requires=bluetooth.service
[Service]
ExecStartPre=/usr/bin/sdptool add --channel=3 SP
ExecStart=/usr/bin/rfcomm watch hci0 3 setsid /sbin/agetty -L rfcomm0 --keep-baud 115200,38400,9600 xterm -a pi
Restart=on-failure
RestartSec=5s
@sumanssaurabh
sumanssaurabh / Git basic cheatsheet
Last active July 29, 2018 09:55
Git basic cheatsheet
#Basic commands
git init //Initalize Local Git Repository
git add <file> //Add Files to index
git status //check status of working tree
git commit //commit changes in index
#remote commands
git push //push to remote Repository
git pull //pull latest from remote Repository
git clone //clone Repository into new directory