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
| #!/usr/bin/env python3 | |
| import sys | |
| import os | |
| mode = sys.argv[1] | |
| command = sys.argv[2] | |
| def markdown_to_pdf(root_filename): | |
| md_filename = root_filename+".md" | |
| pdf_filename = root_filename+".pdf" | |
| print("converting {0} to {1}".format(md_filename, pdf_filename)) | |
| return "pandoc -o {0} {1}".format(pdf_filename, md_filename) |
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
| # you can extract the text from NYT article in javascript console with document.documentElement.outerText | |
| # nyt article is here: http://www.nytimes.com/interactive/2016/01/28/upshot/donald-trump-twitter-insults.html | |
| # first open the file. I saved it as trumpinsults2.txt on my hard drive | |
| # I also changed non-ascii quotes to quotes and got rid of other non-ascii stuff using sublime text, and some code I | |
| # wrote for the purpose from here: https://github.com/paultopia/ascii_punctuation | |
| with open("trumpinsults2.txt") as t: | |
| insults = t.readlines() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| ;; note: the extra case is to fit weird euler def. of fib seq that goes 1, 2, 3, 5, 8, 13, ... rather than 1, 1, 2, 3, 5, 8, 13 | |
| ;; not nearly as cool as the fibs here: https://en.wikibooks.org/wiki/Clojure_Programming/Examples/Lazy_Fibonacci | |
| (def fib | |
| (memoize | |
| (fn [n] | |
| (case n | |
| 0 0 | |
| 1 1 | |
| 2 2 |
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
| (ns upload-file.core | |
| (:require [reagent.core :refer [render atom]] | |
| [cljs.core.async :refer [put! chan <! >!]]) | |
| (:require-macros [cljs.core.async.macros :refer [go go-loop]])) | |
| ;; derived from https://mrmcc3.github.io/post/csv-with-clojurescript/ | |
| ;; and based on reagent-frontend template. | |
| ;; dependencies from project.clj in addition to clojure, clojurescript, and reagent: | |
| ;; [org.clojure/core.async "0.2.395"] |
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
| ;; thanks Mike Fikes for helping me figure out how to do this! | |
| #!/usr/bin/env planck | |
| (ns panpdf.core | |
| (:require [planck.shell :refer [sh]])) | |
| (def s "\"#foo\nbar\"") | |
| (sh "bash" "-c" (str "echo " s " | pandoc -o fbb.html")) |
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
| #!/usr/bin/env python | |
| target_dir = "FULL_PATH_TO_YOUR_TARGET_DIRECTORY_WITH_GIT_REPO" # example: /Users/you/github/backup/ | |
| source_dir = "FULL_PATH_TO_YOUR_TARGET_DIRECTORY_WITH_NO_GIT" # example: /Users/you/Dropbox/ImportantDocuments/ | |
| extensions = ["txt", "md"] # example list of extensions to copy, change to suit you. | |
| import glob, shutil, subprocess, os | |
| source_wildcards = [source_dir + "*." + x for x in extensions] | |
| source_filenames = [] |
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
| ;; -*- mode: emacs-lisp -*- | |
| ;; This file is loaded by Spacemacs at startup. | |
| ;; It must be stored in your home directory. | |
| (defun dotspacemacs/layers () | |
| "Configuration Layers declaration. | |
| You should not put any user code in this function besides modifying the variable | |
| values." | |
| (setq-default | |
| ;; Base distribution to use. This is a layer contained in the directory |
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
| # Ubuntu 16.10 32bit on smallest digitalocean droplet | |
| # Operating as root | |
| # point of this is to have something I can ssh into from iPad to compile and run stuff | |
| # I've run all this stuff interactively, but I think it should work as a shell script... tried to put force confirmation in everything. | |
| # apologies if something blows up, or hangs waiting for confirmation; work in progress | |
| # make sure all is good in the world | |
| apt-get update |
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
| from requests import get | |
| from shutil import copyfileobj | |
| from hashlib import sha256 | |
| import gzip | |
| testhtml = "http://paul-gowder.com/curve/index.html" | |
| testbinary = "http://paul-gowder.com/penguin-square.jpg" | |
| # fetch and save to file | |
| def fetch_and_save(url, name): |