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
# open a website in Chrome (couldn't get FF to work) | |
set site to "http://127.0.0.1:8000/" | |
tell application "Google Chrome" | |
reopen | |
activate | |
tell window 1 | |
make new tab with properties {URL:site} | |
end tell | |
end tell |
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
' '.join([s.strip() for s in my_str.splitlines()]).strip() |
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/python | |
# -*- coding: utf-8 -*- | |
import RPi.GPIO as GPIO | |
from time import sleep | |
pin = 13 | |
blink_delay = 1. | |
GPIO.setup(pin, GPIO.OUT) |
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/python | |
# -*- coding: utf-8 -*- | |
""" | |
recursively crawls directory | |
if any file does not have READ permission | |
squawks to stdout | |
""" | |
import os | |
directory = '/path/to/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
# pip install python-wordpress-xmlrpc | |
from wordpress_xmlrpc import Client, WordPressPost | |
from wordpress_xmlrpc.methods.posts import NewPost | |
from wordpress_xmlrpc.compat import xmlrpc_client | |
from wordpress_xmlrpc.methods import media, posts | |
def post_to_wordpress(title, content, more_info_url, local_img_file): | |
# first upload the image |
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 json | |
import requests | |
url = '' | |
data = json.loads(requests.get(url).text) | |
import json | |
import urllib2 | |
url = '' | |
f = urllib2.urlopen(url) |
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
#include "IRremote.h" | |
IRsend irsend; | |
int LDR_threshold = 250; // this number or higher = sunshine, calibrate me! | |
int LDR_Pin = A0; // analog pin 0 | |
int claw_state = 0; // claw is assumed initially closed for now.. | |
void setup() | |
{ | |
Serial.begin(9600); |
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
# fixing COUVIS ring_obs_ids in .TAB files | |
filename = 'ring/COUVIS_0012_ring_summary.tab' | |
new_filename = 'new/' + filename | |
new_file = open(new_filename, "w") | |
for l in open(filename).readlines(): | |
fname = l.split(',')[1] # file spec name in field 1, quotes intact | |
ring_obs_id = l.split(',')[2][1:].strip('"').strip() # ring_obs_id in field 2 and strip out quotes and spaces |
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
perl -pi -e 's/\015/\r\n/g' file.tab |
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
# http://alextrle.blogspot.com/2011/05/how-to-send-sms-message-with-python.html | |
def sms_when_finished(): | |
if gmail_pw: | |
server = smtplib.SMTP( "smtp.gmail.com", 587) | |
server.starttls() | |
server.login( 'YOUR_NAME@gmail.com',YOUR_GMAIL_PW) | |
server.sendmail('YOUR_NAME@gmail.com','YOUR_PHONE_NUMBER@vtext.com','Your Fabric job is finished!') | |
OlderNewer