Skip to content

Instantly share code, notes, and snippets.

@Moving-Electrons
Moving-Electrons / ambient_conditions.py
Created Jan 16, 2018
This script check ambient conditions every 2 minutes and updates an LED matrix graph accordingly. It uses a Raspberry Pi Zero W, Adafruit VCNL4010 proximity sensor and a Sense HAT. More info can be found at www.movingelectrons.net.
View ambient_conditions.py
#!/usr/bin/python3
# Import the VCNL40xx module.
import Adafruit_VCNL40xx
from sense_hat import SenseHat
import time
import threading
import subprocess
# Create a VCNL4010 instance.
@Moving-Electrons
Moving-Electrons / bear_to_pelican.py
Last active Jan 8, 2019
Python 3 script for exporting Bear App documents to Pelican Site Generator. The script takes a zip file (argument) containing the exported files in Markdown format from Bear App (i.e. MD file and images), reformats the MD adequately and moves the files to Pelican content folders. More information on www.movingelectrons.net
View bear_to_pelican.py
import sys
import re
import os
import zipfile
import shutil
# Constant Definition
# -------------------
# Path to be prepended to image links in markdown file, like so: ![](IMAGE_LINK<image_filename>).
@Moving-Electrons
Moving-Electrons / pelican_injection-gist.py
Last active Mar 20, 2018
Python 3.5 script for processing files exported from Ulysses in either .md format or .zip format (including images) to be used on Pelican static site generator. The script inserts HTML code, moves images to the appropriate folders in Pelican and expands markdown image links accordingly. Visit www.movingelectrons.net for more info.
View pelican_injection-gist.py
import sys
import re
import os
import zipfile
import shutil
# Constant Definition
# -------------------
@Moving-Electrons
Moving-Electrons / generate_tasks_graph.py
Created Jan 1, 2016
This script takes two arguments (Taskpaper filename and Output image filename) and returns a graph showing the number of tasks due per day. More information on www.movingelectrons.net
View generate_tasks_graph.py
import sys
import re
import datetime as dt
from collections import Counter
import pandas as pd
import seaborn as sns
'''
This script takes the following arguments and returns a graph showing the number of tasks due per day.
@Moving-Electrons
Moving-Electrons / Sort_Tasks.py
Created Dec 21, 2015
This script generates a text/markdown file with the tasks from a taskpaper file sorted by due date in three groups: Overdue, Today and Tomorrow. Check out www.movingelectrons.net for more information.
View Sort_Tasks.py
import sys
import re
import operator
import datetime
'''
This script generates a text/markdown file with the tasks from a taskpaper file sorted by due date in three groups:
Overdue, Today and Tomorrow. Also, all tasks with the @today tag are placed in the Today group.
The following parameters should be passed when running the script:
@Moving-Electrons
Moving-Electrons / reschedule_done.py
Created May 3, 2015
This script takes the taskpaper file passed as an argument and reschedules completed recurring tasks based on their due date, done date and recurring frequency. The task is put in the project it was completed on, even if it has been archived at the end of the file. The script looks for the following tags: - @Due(YYYY-MM-DD) e.g. @Due(2015-04-17) -
View reschedule_done.py
#!/usr/bin/python2.7
import re
import shutil
import os
import sys
from datetime import date, timedelta
''' This script takes the taskpaper file passed as an argument and reschedules completed recurring tasks based on their
due date, done date and recurring frequency. The task is put in the project it was completed on, even if it has been
@Moving-Electrons
Moving-Electrons / MarkdownEditor-Cobaltish.tmTheme
Created Dec 19, 2014
This is a Color Scheme for the MarkdownEditing plugin/package for Sublime Text. It was built based on the Dark Color Scheme included in the package and the Cobalt 2 Theme. More information in www.movingelectrons.net.
View MarkdownEditor-Cobaltish.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>MarkdownEditing</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@Moving-Electrons
Moving-Electrons / tweet_schedule.py
Created Dec 15, 2014
This script reads pre-formatted tweets from a text file and posts them at defined intervals. It uses the Twython library (wrapper for Twitter API). More information at www.movingelectrons.net
View tweet_schedule.py
#!/usr/local/bin/python2.7
import datetime
import time
import re
import os
from twython import Twython
import sys
import traceback
import httplib, urllib #used in the Pushover code
@Moving-Electrons
Moving-Electrons / woot_alert.py
Created Aug 31, 2014
This python script parses all woot.com feeds and searches for predefined words in each item title. If it finds a match, it sends an instant message through Pushover (pushover.net). It also logs all the posted items in text files per category. More information in www.movingelectrons.net
View woot_alert.py
import feedparser #need manual installation. Doesn't come with Python.
import os
import httplib #used by pushover
import urllib #used by pushover
# Linux:
folderPath = '/home/YOUR_USERNAME/Scripts/Support_Files/Woot/'
# Just woot.com items:
@Moving-Electrons
Moving-Electrons / ssh_command.py
Last active Feb 22, 2018
This script connects through SSH to the Computer/Server using the Username & Password defined in the header. It then runs a command/script that is passed as an argument by long pressing the Run icon in Pythonista or by calling the script through Pythonista's URL scheme with an argument. More information in www.movingelectrons.net , scripting sec…
View ssh_command.py
import paramiko
import console
import sys
import keychain
'''This script connects through SSH to the Computer/Server using the Username & Password defined in the header.
It then runs a command/script that is passed as an argument by long pressing the Run icon in Pythonista or by
calling the script through Pythonista's URL scheme with an argument.
General Notes: