Skip to content

Instantly share code, notes, and snippets.

@fcrespo82
fcrespo82 / gist:4137305
Created November 23, 2012 21:01
Script to sync Pythonista App to Dropbox
import webbrowser, os, pprint
# Include the Dropbox SDK libraries
#from dropbox import client, rest, session
import dropbox
# Configuration
TOKEN_FILENAME = 'PythonistaDropbox.token'
# Get your app key and secret from the Dropbox developer website
APP_KEY = '<your dropbox app_key>'
APP_SECRET = '<your dropbox app_secret>'
@fcrespo82
fcrespo82 / gist:5033378
Created February 25, 2013 21:14
Open SMS compose window with prepopulated number and body
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
picker.recipients = [NSArray arrayWithObject:@"48151623"];
picker.body = @"Body text.";
[self presentModalViewController:picker animated:YES];
[picker release];
@fcrespo82
fcrespo82 / RodarComoAdmin.txt
Last active December 15, 2015 06:19
This gist shows how to run an app as admin in OS X
on run {input, parameters}
using terms from application "Finder"
set filepath to POSIX path of input
do shell script "open '" & filepath & "'" with administrator privileges
end using terms from
end run
@fcrespo82
fcrespo82 / pushover.py
Created March 21, 2013 21:39
This gist describes how to send messages via push to your phone using pushover API
import requests
USER_TOKEN = u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' #replace with your user key
APP_TOKEN = u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' #replace with your APP token/key
HEADERS = { "Content-type": "application/x-www-form-urlencoded" }
def sendPush(message, title, url, url_title):
parameters = { u'token': APP_TOKEN,
u'user': USER_TOKEN,
@fcrespo82
fcrespo82 / SearchGooglePlaces.py
Last active September 29, 2021 23:01
Python script for pythonista (iOS app) to search google places API and open the first result in Apple Maps
# -*- coding: utf-8 -*-
import requests, json, webbrowser, urllib, sys
API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' # Get your api key from https://code.google.com/apis/console/, you MUST add the Places API permission to it
GOOGLE_PLACES_URI = 'https://maps.googleapis.com/maps/api/place/textsearch/json?query={0}&sensor=false&key={1}'
APPLE_MAPS_URI = 'safari-http://maps.apple.com/?q={0}'
#call this script in pythonista for ios pythonista://GoogleToAppleMaps?action=run&argv=[prompt]
def main():
@fcrespo82
fcrespo82 / iTunesLiveTile.html
Last active December 8, 2017 20:26
Simple javascript helper to acquire iTunes data from the lookup API.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>iTunes Live Tile</title>
</head>
<body>
<div id='iltdemo'>
Icon: <img id='image'></img><br/>
Name: <span id='name'></span><br/>
@fcrespo82
fcrespo82 / gist:5406500
Created April 17, 2013 18:17
QR code shortcode for wordpress
<?php
function qr($atts, $content=null) {
extract(shortcode_atts( array('url' => ''), $atts));
$googleurl = 'https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=' . urlencode($url);
return '<img src="' . $googleurl . '" />';
}
add_shortcode('qr', 'qr');
?>
@fcrespo82
fcrespo82 / RandomSMS.py
Last active December 27, 2015 02:09
Python script to generate random SMS messages based on templates
# -*- coding: utf-8 -*-
import urllib
import random
import webbrowser
import types
SMS_URL_SCHEME = "launchpro-messaging://?to=[PHONE_HERE]&body={0}"
TEMPLATES = [
@fcrespo82
fcrespo82 / due.py
Created December 18, 2013 21:22
Send Due tasks from any computer with Python
#! /usr/bin/env python
import pushover
import sys
import datetime
import dateutil.parser
import urllib
DUE_URL = "due://x-callback-url/add?title={0}&duedate={1}&timezone=GMT"
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################