Skip to content

Instantly share code, notes, and snippets.

@slackorama
slackorama / panagram.py
Last active Jan 13, 2021
Solve the NYT spelling bee. Mind you this isn't perfect.
View panagram.py
#!/usr/bin/env python3
import sys
# called via `panagram.py ktocail`
# last letter in the word is required
def get_words(letters):
# prevent dupes
seen = set()
@slackorama
slackorama / goodreads.py
Created Jan 8, 2019
get your read shelf from good reads and output an org table.
View goodreads.py
#!/usr/bin/env python
"""Grab the books from the current year from goodreads and emit an org mode table.
"""
from __future__ import print_function
import datetime
from email.utils import parsedate
import sys
import time
from xml.dom import minidom
View foobar.py
from lxml import objectify
tree = objectify.parse('/home/seth/Downloads/slackorama-2018-01-17-pettit-1-9725148.tcx')
root = tree.getroot()
namespaces = {'ns': 'http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2',
'ns3': 'http://www.garmin.com/xmlschemas/ActivityExtension/v2'}
for tp in root.xpath('//ns:Trackpoint', namespaces=namespaces):
print(tp.Time);
print(tp.xpath('.//ns:Extensions/ns3:TPX/ns3:Watts', namespaces=namespaces)[0])
@slackorama
slackorama / app.py
Last active Jan 8, 2019
pull info from strava
View app.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cStringIO
import codecs
import csv
import logging
import sys
import webbrowser
@slackorama
slackorama / 02-124528.rtm.py
Created Dec 2, 2016
pull a list from rtm and dump it in org
View 02-124528.rtm.py
import rtm
token = '' # get this somewhere else
# this is the token and secret from the rtm-cli app so I assume putting it here is ok
milk = rtm.createRTM('cbc76268b901ccb8d9fc5f3aebc4ee1f',
'131beea786379309',
token
)
View foo.el
(defun slack-lt/init-erc ()
"Initialize ERC"
(use-package erc
:init
(spacemacs/set-leader-keys
"aie" 'erc
"aiv" 'ssm-connect-slack-work
"aif" 'ssm-connect-freenode
"aib" 'ssm-connect-bitlbee
"aii" 'erc-track-switch-buffer)
View *temp*-72072.txt
Fri Aug 12 19:15:14 manager@axnq001.bur:~$ ls -al /var/EdgeCast/axnq/axnq*db
-rw-r--r-- 1 manager manager 927333376 Aug 24 2015 /var/EdgeCast/axnq/axnq-2015-08-24-20-46.db
-rw-r--r-- 1 manager manager 1058237440 Sep 28 2015 /var/EdgeCast/axnq/axnq-2015-09-27-06-28.db
-rw-r--r-- 1 manager manager 175880192 Nov 5 2015 /var/EdgeCast/axnq/axnq-2015-11-05-22-17.db
-rw-r--r-- 1 manager manager 291045376 Dec 11 2015 /var/EdgeCast/axnq/axnq.20151211.db
-rw-r--r-- 1 root root 267862016 Jan 19 2016 /var/EdgeCast/axnq/axnq-2016-01-19-19-05.db
-rw-r--r-- 1 root root 763152384 Mar 17 20:38 /var/EdgeCast/axnq/axnq-2016-03-17-20-38.db
-rw-r--r-- 1 root root 1253299200 May 11 19:11 /var/EdgeCast/axnq/axnq-2016-05-11-19-11.db
-rw-r--r-- 1 manager manager 1265500160 May 12 20:40 /var/EdgeCast/axnq/axnq-2016-05-12-13-41.db
-rw-r--r-- 1 manager manager 215956480 Jun 1 05:53 /var/EdgeCast/axnq/axnq-2016-05-31.db
View es-index-rate.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import time
import requests
SLEEP_TIME = 5
View *text*.txt
Debugger entered--Lisp error: (void-function org-capture-template-prompt-history::Title)
org-capture-template-prompt-history::Title("" nil t)
all-completions("" org-capture-template-prompt-history::Title nil)
helm-comp-read-get-candidates(org-capture-template-prompt-history::Title nil nil nil)
#[0 "\304\302\300\305\303$\211\205\306\307\310\301\"\"\207" [nil "" org-capture-template-prompt-history::Title nil helm-comp-read-get-candidates nil delete "" helm-cr-default] 6 "\n\n(fn)"]()
apply(#[0 "\304\302\300\305\303$\211\205\306\307\310\301\"\"\207" [nil "" org-capture-template-prompt-history::Title nil helm-comp-read-get-candidates nil delete "" helm-cr-default] 6 "\n\n(fn)"] nil)
helm-funcall-with-source(((name . "org-capture History") (candidates . #[0 "\304\302\300\305\303$\211\205\306\307\310\301\"\"\207" [nil "" org-capture-template-prompt-history::Title nil helm-comp-read-get-candidates nil delete "" helm-cr-default] 6 "\n\n(fn)"]) (action ("Sole action (Identity)" lambda (candidate)
View *elfeed-entry*.txt
(help/on-osx
(setq mac-control-modifier 'control)
(setq mac-right-control-modifier 'left)
(setq mac-command-modifier 'meta)
(setq mac-right-command-modifier 'left)
(setq mac-option-modifier 'super)
(setq mac-right-option-modifier 'left)
(setq mac-function-modifier 'hyper)
(defun help/toggle-mac-right-option-modifier ()
"Toggle between passing option modifier either to Emacs or OS X."