Skip to content

Instantly share code, notes, and snippets.

@vikramdurai
vikramdurai / gocalc.go
Last active November 6, 2023 15:44
A simple calculator made with Go
package main
import (
"bufio"
"errors"
"fmt"
"os"
"strconv"
"strings"
)
@vikramdurai
vikramdurai / new_lang.py
Last active April 26, 2017 06:04
I know I'm probably an idiot to want another programming language. I'm doing this only for learning.
# a simple if statement
# no else statement for
# simplicity
class If:
def check(self, condition):
if condition:
self = True
# function code
class Func:
def __init__(self, args, code):
@vikramdurai
vikramdurai / task_runner.py
Created April 20, 2017 04:09
a simple task runner
""""
A simple task runner like Grunt or Gulp for Python, but uses only two types of tasks:
`build` and `concat`. Will extend for more tasks, like `clean` and `compile`.
"""
class task:
def __init__(self, actionfile, run=True, concat=False, concat_file=False, concat_new_file=False):
self.file = actionfile
if concat:
self.concat = True
@vikramdurai
vikramdurai / pyshell.py
Created April 16, 2017 07:18
A command-line interpreter for Python
"""A basic interpreter for Python, using the eval() function."""
# print startup info
print("Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32")
print("Type \"copyright\", \"credits\" or \"license()\" for more information.")
while True:
code = input(">>> ")
# try to run the code entered
try:
@vikramdurai
vikramdurai / searchengine.py
Created November 28, 2016 15:11
A small search engine using the Python dictionary.
keywords = {
"google":"Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at \
Stanford University, California. Together, they own about 14 percent of its shares and control 56 percent \
of the stockholder voting power through supervoting stock. They incorporated Google as a privately held \
company on September 4, 1998. An initial public offering (IPO) took place on August 19, 2004, and Google \
moved to its new headquarters in Mountain View, California, nicknamed the Googleplex.",
"skype":"Skype (/ˈskaɪp/) (stylized as skype) is an application that provides video chat and \
voice call services. Users may exchange such digital documents as images, text, video and any others, \
and may transmit both text and video messages. Skype allows the creation of video conference calls. \
Skype is available for Microsoft Windows, Macintosh, or Linux, as well as Android, Blackberry, \