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 sys | |
import subprocess | |
import os.path | |
import inflect | |
# alias blog="python ~\Desktop\30DaysOfBlogging\blog.py" | |
# Run the script with `blog <title>` | |
def main(): |
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 sys, subprocess, os.path, time | |
# alias m2h="python ~\Desktop\30DaysOfBlogging\m2h.py" | |
# Run the script with `m2h <markdown file>` | |
# One argument, which is the name of the to be created markdown file | |
if len(sys.argv) is not 2: | |
print("ERROR: One and only one argument needed. Markdown file") | |
sys.exit() |
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 org.apache.spark.sql.Dataset; | |
import org.apache.spark.sql.Row; | |
import org.apache.spark.sql.SparkSession; | |
import static org.apache.spark.sql.functions.col; | |
import static org.apache.spark.sql.functions.desc; | |
public class DataSetMain { | |
public static void main(String[] args) { | |
// Initialize Sparksession |
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 json | |
import requests | |
access_token = '181d415f34379af07b2c11d144dfbe35d' #Fake token, obviously! | |
headers = { | |
'Authorization': "Bearer " + access_token, | |
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84' | |
} |
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
#!/bin/bash | |
shopt -s expand_aliases | |
source ~/.bashrc | |
[ $# -eq 0 ] && { | |
echo "Title argument missing" | |
echo "Usage: blog-it <article-title>"; | |
exit 1; | |
} |
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
# Should read in Article title, tags from the md file | |
# Call the modifications file and do it on the output html | |
# Publish to Blogger but as a draft | |
import sys, os, re | |
import blogger_publish, medium_publish | |
import CommentParser | |
def main(): |
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
# Call easyblogger | |
# Client secret and authentication is already stored in ~/.easyblogger.credentials | |
# blogid is stored in ~/.easyblogger | |
import subprocess | |
import blogger_modifications | |
def publish(html_file, title, labels, post_id): | |
# print('publishing', html_file, 'with title', title, 'labels', labels, 'and post-id', post_id, flush=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 sys | |
import os | |
import fileinput | |
# alias modifications="python ~/Desktop/30DaysOfBlogging/modifications.py" | |
# Run the script with `modifications <markdown file>` | |
def modify(html_file): | |
# If file doesnot exist, just exit |
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 json | |
import requests | |
import os | |
import sys | |
def publish(html_file, title, labels): | |
access_token_file = '~/.medium-access-token' | |
expanded_path = os.path.expanduser(access_token_file) | |
print(expanded_path) |
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 tweepy | |
import os | |
import re | |
import CommentParser | |
import sys | |
import subprocess | |
import yaml | |
def tweet(html_file, post_url): |