This file contains hidden or 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
// Disable bold. | |
term_.prefs_.set('enable-bold', false) | |
// Use this for Zenburn | |
term_.prefs_.set('background-color', "#3F3F3F"); | |
term_.prefs_.set('foreground-color', "#DCDCCC"); | |
base03 = "#002b36"; | |
base02 = "#073642"; | |
base01 = "#586e75"; |
This file contains hidden or 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
# i/p = array of numbers | |
# create a binary tree such that each subtree is a min-heap and the inorder traversal // of the binary tree is same as the array provided | |
# [5, 7, 10, 8, 1, 4] | |
# 1 | |
# / \ | |
# 5 4 | |
# \ | |
# 7 |
This file contains hidden or 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 function takes Open Graph info and just returns the articles | |
def returnArticles(og_array): | |
article_urls = [] | |
for og in og_array: | |
is_article = False | |
for prop in og: | |
if hasattr(prop, "property"): | |
if prop["property"] == "og:type": | |
if prop["content"] == "article": | |
is_article = True |
This file contains hidden or 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 boto3 | |
def get_id_from_name(name): | |
description = [instance for r in response['Reservations'] for instance in r['Instances'] for tag in instance['Tags'] if tag['Key'] == 'Name' if tag['Value'] == name] | |
return description['InstanceId'] | |
def start_instance_by_name(name): | |
ec2 = boto3.client('ec2') | |
instance_id = get_id_from_name(name) | |
# Do a dryrun first to verify permissions |
This file contains hidden or 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
def brand_from_url(url): | |
domain_list = urlparse(url).netloc.split('.') | |
if(len(domain_list) < 3): | |
brand= domain_list[0] | |
else: | |
brand = domain_list[1] | |
return brand |
This file contains hidden or 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 file is a helper function to scrape Github for Repo's to add to my website. | |
It can be set to run whenever Gatsby is called in order to add new Repo's as they arrive. | |
Usage: python RepoScraper.py SampleOutput.js | |
''' | |
from sys import argv | |
from github import Github | |
import re |
This file contains hidden or 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 re | |
from datetime import datetime | |
import errno | |
def titleToUrl(title): | |
lowerTitle = title.lower() | |
URL = lowerTitle.replace(" ", "-") | |
return "/blog/" + URL + "/" |
NewerOlder