This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def check(lower, upper): | |
mid = (lower + upper) // 2 | |
if lower == mid or upper == mid: | |
# base case | |
return mid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import fileinput | |
def main(): | |
files = [f for f in os.listdir() if f.endswith('.md')] | |
for filename in files: | |
date = filename[:10] | |
print(date, filename) | |
with fileinput.FileInput(filename, inplace=1) as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this script is based on something I saw on stackoverflow | |
# https://stackoverflow.com/questions/42704995/brute-force-script | |
# author: Arjun Krishna Babu | |
# This is a poorly written code for entirely private purposes. Please don't judge me. | |
from pexpect import pxssh | |
import sys | |
import threading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from string import Template | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument("file", help="path to input file") | |
args = parser.parse_args() | |
t = Template("|$sno|[$title]($link){:target='_blank'}|$author|") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Tree a = Leaf a | |
| Node (Tree a) (Tree a) | |
deriving (Show, Eq) | |
treeMap :: (a -> b) -> (Tree a) -> (Tree b) | |
treeMap f (Leaf a) = Leaf (f a) | |
treeMap f (Node t1 t2) = Node (treeMap f t1) (treeMap f t2) | |
treeFold :: (b -> b -> b) -> (a -> b) -> (Tree a) -> b | |
treeFold fnode fleaf (Leaf n) = fleaf n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS=-g | |
OBJS=greedy.o random.o randomgraph.o sig.o | |
all: greedy random randomgraph sig | |
greedy: greedy.o | |
$(CC) $(CFLAGS) -o greedy greedy.o | |
random: random.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from string import Template | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
MY_ADDRESS = 'my_address@example.comm' | |
PASSWORD = 'mypassword' |