Skip to content

Instantly share code, notes, and snippets.

View geekykant's full-sized avatar

Sreekant Shenoy geekykant

View GitHub Profile
@geekykant
geekykant / app.py
Created March 28, 2019 08:04
Play music for every new line added to text file
import os
old_ll = None
new_ll = None
with open("values.txt", "r+") as f:
for old_ll in f:
pass
while(1):
@geekykant
geekykant / get_local_ip.js
Created April 18, 2019 09:22
Get local IP address on a network using JS.
window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;//compatibility for Firefox and chrome
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};
pc.createDataChannel('');//create a bogus data channel
pc.createOffer(pc.setLocalDescription.bind(pc), noop);// create offer and set local description
pc.onicecandidate = function(ice)
{
if (ice && ice.candidate && ice.candidate.candidate)
{
var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];
pc.onicecandidate = alert(`IP Address: ${myIP}`);
@geekykant
geekykant / hotspot_ip
Created July 17, 2019 13:37
Get Hotspot IP Address
private String getHotspotIpAddress() {
String ip = "";
try {
Enumeration<NetworkInterface> enumNetworkInterfaces = NetworkInterface
.getNetworkInterfaces();
while (enumNetworkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = enumNetworkInterfaces
.nextElement();
Enumeration<InetAddress> enumInetAddress = networkInterface
.getInetAddresses();
def get_a(n):
a = next_large_prime(n)
def next_large_prime(num):
while(True):
num+=1
if(is_prime(num)):
return num
def is_prime(num):
def isprimebad(n):
if n < 2:
return(False)
else:
for i in range(2,n):
if n%i == 0:
return(False)
return(True)
def lexsortbad(l):
clc;
clear all;
close all;
rp = input('Enter the pass band ripple: ');
rs = input('Enter the stop band ripple: ');
wp = input('Enter the pass band freq: ');
ws = input('Enter the pass band freq: ');
fs = input('Enter the sampling freq: ');
w1= (2*wp)/fs;
clc;
clear all;
close all;
rp = input('Enter the pass band ripple: ');
rs = input('Enter the stop band ripple: ');
wp = input('Enter the pass band freq: ');
ws = input('Enter the pass band freq: ');
fs = input('Enter the sampling freq: ');
w1= (2*wp)/fs;
{
"statuses": [
{
"created_at": "Mon May 06 20:01:29 +0000 2019",
"id": 1125490788736032770,
"id_str": "1125490788736032770",
"text": "Today's new update means that you can finally add Pizza Cat to your Retweet with comments! Learn more about this ne… https://t.co/Rbc9TF2s5X",
"truncated": true,
"entities": {
"hashtags": [],
# Web streaming example
# Source code from the official PiCamera package
# http://picamera.readthedocs.io/en/latest/recipes2.html#web-streaming
import io
import picamera
import logging
import socketserver
from threading import Condition
from http import server
Navigate.java
package com.diyandroid.beacon;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.util.Log;
import android.view.View;
import android.widget.Button;