Skip to content

Instantly share code, notes, and snippets.

View ishankhare07's full-sized avatar
👨‍💻

Ishan Khare ishankhare07

👨‍💻
View GitHub Profile
@ishankhare07
ishankhare07 / sjf.py
Created August 31, 2014 16:52
shortest job first algo
from __future__ import print_function, division
import os
job_list = []
id = 0
def calc_wt():
temp = []
for x in job_list:
sum = 0
@ishankhare07
ishankhare07 / browser.sh
Created September 8, 2014 06:38
shell script for launching the browser and taking to specified address
echo "Select a browser "
echo "1. Chrome"
echo "2. Firefox"
read browser
echo "Which site you want to goto? "
read name
echo "Taking you to site $name"
@ishankhare07
ishankhare07 / class implements
Created January 22, 2015 14:15
interface implementation through a class
interface onClickListener {
public void onClick();
}
public class Practice implements onClickListener {
@Override
public void onClick() {
System.out.println("this is a demo");
}
@ishankhare07
ishankhare07 / interface object
Created January 22, 2015 14:17
java interface implementation via object creation
interface onClickListener {
public void onClick();
}
public class Practice {
public static void main(String[] args) {
onClickListener my_listener = new onClickListener() {
@Override
public void onClick() {
System.out.println("this is a demo");
@ishankhare07
ishankhare07 / testing.py
Last active August 29, 2015 14:15
gtkSource comaptibility importer
from gi.importer import DynamicImporter
DynamicImporter('GtkSource')
<gi.importer.DynamicImporter object at 0xb6e131ec>
@ishankhare07
ishankhare07 / keypress.html
Last active August 29, 2015 14:16
javascript detecting keypress
<!DOCTYPE html>
<html>
<head>
<title>key test</title>
</head>
<script>
window.onkeypress = check_return;
function check_return(event) {
@ishankhare07
ishankhare07 / omega.py
Created March 25, 2015 13:59
cProfile based python profiling an omega network perfect shuffle simulation
#simulate omega network
import math
import sys
import cProfile, pstats
class simulate:
def __init__(self):
self.a = range(int(input('Enter number of inputs:')))
self.b = self.a[:]
self.count = int(math.log(len(self.a),2))
@ishankhare07
ishankhare07 / get.py
Last active August 29, 2015 14:18
python socket GET request
import socket
class Get:
"""
this class makes get request to httpbin
"""
def __init__(self):
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,0)
@ishankhare07
ishankhare07 / weather.py
Last active August 29, 2015 14:19
weather notification
from gi.repository import Notify
import requests
import time
import os
import sys
class notification:
"""
To run this script, simply type:
python3 weather.py [time_interval] city &
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<div class="gradient">
</div>