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
"""Script to convert jekyll style posts to hugo style.""" | |
import os | |
bdir = "./jekyll-posts/" | |
adir = "./post/" | |
titles = os.listdir(bdir) | |
dicts = [{ |
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
def flatten(lst): | |
flt_lst = [] | |
for item in lst: | |
if not type(item) == list: | |
flt_lst.append(item) | |
else: | |
flt_lst.extend(flatten(item)) | |
return flt_lst | |
def fizzbuzz(n=101): |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Network.HTTP.Simple | |
import Web.Scotty | |
import Data.Monoid (mconcat) | |
import Network.Wai.Middleware.Cors | |
main = scotty 3000 $ do |
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
def repeater(func): | |
def repeat(arg): | |
if (type(arg) == int): | |
for _ in range(arg): | |
func(arg) | |
else: | |
func(arg) | |
return repeat | |
def upper(func): |
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
package main | |
import ( | |
"os" | |
"fmt" | |
"net/http" | |
rc_api "github.com/JKiely/RC-API" | |
) | |
const htmlIndex = `<html><body> |
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 random | |
class Ngram: | |
def __init__(self, doc, n=2): | |
self.N = n | |
self.wordlist(doc) | |
self.make_db() | |
def wordlist(self, doc): |
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 random | |
class Bigram: | |
def __init__(self, doc): | |
self.wordlist(doc) | |
self.make_grams() | |
def wordlist(self, doc): | |
with open(doc, 'r') as f: | |
self.words = f.read().split() |