Skip to content

Instantly share code, notes, and snippets.

View svineet's full-sized avatar

Sai Vineet svineet

View GitHub Profile
@svineet
svineet / Calc.bas
Created September 30, 2012 07:19
QBASIC Code for a simple calculator program
CLS
SCREEN 13
PRINT "CALCULATOR-"
PRINT "ENTER YOUR EXPRESSION"
PRINT "EXAMPLE-58 * 20"
PRINT "THE TERMS SHOULD BE SEPARATED BY SPACE OR ERROR WILL OCCUR"
INPUT "ENTER YOUR EXPRESSION-"; EXP$
EXP$ = EXP$ + " "
@svineet
svineet / zenexample.htm
Created October 19, 2012 09:25
Example of complex html structure
<html>
<body>
<ul>
<li>link 1</li>
<li>link 1</li>
<li>link 1</li>
<li>link 1</li>
</ul>
</body>
</html>
@svineet
svineet / tweets.py
Created January 17, 2013 10:55
A python program to fetch and print out the last 5 tweets made by a user(taken as input) using the twitter REST api.
import requests
import json
def main():
handle = raw_input('Twitter handle(without @)-')
r = requests.get('https://api.twitter.com/1/statuses/user_timeline/'+handle+'.json?callback=?&count=5')
obj = json.loads(r.content)
for i in range(0,5):
print "-"*24
print obj[i]['user']['name'] + " tweeted -"
@svineet
svineet / index.html
Created February 18, 2013 15:55
A CodePen by Sai Vineet. Dropdown Menu! - A simple dropdown menu in CSS3 using transitions.
<div id="container">
<div class="slider" style="background:#B5E61D;">
<button>lala</button>
</div>
<div class="slider" style="background:#00A2E8;"></div>
<div class="slider" style="background:#4AD977;"></div>
<div class="slider" style="background:#FFC90E;"></div>
<div class="slider" style="background:#3F48CC;"></div>
</div>
@svineet
svineet / IMOresults.py
Last active February 4, 2023 11:13
A script that checks imo results for kinshuks result.
import requests
uri = "http://www.sofworld.org/imo-second-level-result/JH02800800"
for i in range(1,10):
print i
r = requests.get( uri+str(i) )
if "KINSHUK" in r.content:
print "Found it! I'm opening it in the browser now"
import webbrowser
@svineet
svineet / main.py
Created April 6, 2013 08:23
A gist to gather the whole merchant of venice explanation from 'SparkNotes' named website.
import requests
import BeautifulSoup
def main():
print "Hey! Let's start Doing things"
done=False; i = 0 ; acc = "<html><body>"
while (i<=50):
i = i + 2
print "Getting {0}".format(i)
r = requests.get(
@svineet
svineet / pi.py
Created April 16, 2013 11:32
Pi calculator. It's accurate for 5 digits after decimal.
def main():
print "Calculating pi. Calm down,bro!"
acc = 0.0
for i in range(1,1000001,4):
acc += 4/float(i)
acc -= 4/float(i+2)
print i
@svineet
svineet / VerEx.rb
Created August 17, 2013 07:01
Method -chaining implementation of [VerEx](http://verbalexpressions.github.io/) in Ruby. The other [implementation](https://github.com/ryan-endacott/verbal_expressions) uses DSL. This is just a emperiment. May have a lot of bugs, and is not by any means complete.
# This is a program trying to implement Verbal Expressions
# See this for more info - http://verbalexpressions.github.io/
def VerEx
return VerExClass.new
end
class VerExClass
@regex = "" # The main regex variable
@svineet
svineet / tic-tac-toe-tomek.py
Created September 21, 2013 09:33
Google Code Jam problem - "Tic-Tac-Toe-Tomek" Link to problem - https://code.google.com/codejam/contest/2270488/dashboard
#!/usr/bin/python
X = "X"
O = "O"
T = "T"
cases = ["",
"X won",
"Draw",
"Game has not completed",
"O won"]
@svineet
svineet / BFS.py
Last active August 29, 2015 14:03
BFS to solve shortest path in maze
#!/usr/bin/env python
adj = {}
m = """012
345
678
"""
# Contruct adj list