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 | |
import json | |
import os | |
from copy import deepcopy | |
APIKEY = os.environ["ZOTEROKEY"] | |
ACCOUNT = os.environ["ZOTEROACCOUNT"] | |
TESTITEM = '10.2307/4486062' # just the same example item used on https://github.com/zotero/translation-server | |
def get_item_from_identifier(identifier): | |
endpoint = "http://zotglitch.glitch.me/search" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
(require '[clojure.core.match :refer [match]]) | |
(defn discard-nils [a b] | |
(match [a b] | |
[_ nil] a | |
:else b)) | |
(def safe-merge (partial merge-with discard-nils)) | |
;; examples |
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
# Quick and dirty script to post a bluesky thread via API | |
# because I hate having to manually break up long text at character count limits | |
# largely adapted/swiped from the more full-featured library at https://github.com/ianklatzco/atprototools/tree/master | |
import requests | |
import datetime | |
import textwrap | |
import appex # this is a pythonista (ipad/ios python app) library for share sheet functionality, omit on real computer | |
import sys | |
import keychain # pythonista library, for a real computer use envirnoment variables instead |
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
# Quick and dirty script to post via API, mostly for the purposes of | |
# making threads without having to manually break up at character count breaks (in version 2) | |
# largely adapted/swiped from the more full-featured library at https://github.com/ianklatzco/atprototools/tree/master | |
import requests | |
import datetime | |
# Authentication information | |
# n.b.: ketchain is a pythonista (ipad/ios python app) library, for a real computer use envirnoment variables instead | |
import keychain |
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
#!/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 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
# PROBLEM: Zotero loves to grab the URL and last accessed date of articles and books and such when you use the | |
# zotero browser extensions to get them into the citation manager. Then those things incorrectly show up in your | |
# automatically generated citations, e.g., when using the bluebook citation format. | |
# And it's really obnoxious to delete them all by hand either in the output or zotero. | |
# SOLUTION: use CSL json as your output for processing with pandoc or whatever (which you should be doing anyway) | |
# and then interpose this little script between the raw CSL json file and cleaned up CSL json file with the URLs etc. | |
# stripped. | |
# USAGE: "python clean_cite_json.py YOUR_EXISTING_CITATION_FILE NEW_FILENAME_FOR_CLEAN_FILE" |
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
;; -*- 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 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 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
# for the pythonista ios app (which comes with sympy bundled) | |
# allows one to create a text file, for example in drafts, containing the string | |
# x - (9 * 5) = x / 2 | |
# and then share it into this pythonista script (or copy it to clipboard and run the script) | |
# and get the answer (90) back. | |
# see comments at end for more examples of stuff that it can solve. | |
# | |
# I wrote this because it annoys me that there are paid apps that do ticker tape calculator kinds of | |
# things. Why should I pay extra to add up a list of numbers whilst still getting to see the numbers when | |
# I have a whole programming language available to me! |
NewerOlder