Skip to content

Instantly share code, notes, and snippets.

View james-see's full-sized avatar
🍀
make your own luck

JC james-see

🍀
make your own luck
View GitHub Profile
@james-see
james-see / squarify.py
Created April 24, 2014 05:07
Pythonista Script to Post Non-Square Images to Instagram without cropping
from PIL import Image, ImageOps
import clipboard, photos,webbrowser
im=photos.pick_image()#clipboard.get_image
if im.size[0] >= im.size[1]:
whitespace=((im.size[0]-im.size[1])/2)+250
xbump=250
else:
xbump=((im.size[1]-im.size[0])/2)+250
whitespace=250
matted=ImageOps.expand(im,border=(xbump,whitespace),fill='white')
@james-see
james-see / post_flickr_instagram.py
Last active October 2, 2016 18:21
This script I use in pythonista to post to Flickr and then square the image and post to Instagram, all in a single step. The title of the image is a random five digit number as well.
from PIL import Image, ImageOps
import clipboard, photos,webbrowser
# Example for sending an email with an attached image using smtplib
#
# IMPORTANT: You need to enter your email login in the main() function.
# The example is prepared for GMail, but other providers
# should be possible by changing the mail server.
import smtplib
import os
import markdown
import requests
import webbrowser
pinToken = 'Put your Pinboard API token here'
pinAPI = 'api.pinboard.in/v1/'
pinGet = 'posts/all'
pinURL = 'https://' + pinAPI + pinGet + '?auth_token=' + pinToken + '&toread=yes&format=json'
@james-see
james-see / getpins.py
Created January 2, 2015 03:26
getpins.py
# this script gets your most recent pinboard items
# set your username and tag of interest
# it copies a markdown formatted list to the clipboard for easy export
# the script gets the most recent five items by default
# code by James Campbell @jamescampbell on twitter
import feedparser
import console
import clipboard
import webbrowser
@james-see
james-see / TWEEPORTER.py
Created January 3, 2015 18:11
Python Command Line Interface Twitter Reporter tool
#python twitter example
#last updated December 24 2014
#James Campbell http://www.jamescampbell.us
# @jamescampbell on twitter
#
#
# twitter items available:
#contributors, truncated, text, in_reply_to_status_id, id, favorite_count, source, retweeted,
#coordinates, entities, in_reply_to_screen_name, in_reply_to_user_id, retweet_count, id_str, favorited,
#retweeted_status, user, geo, in_reply_to_user_id_str, lang, created_at, in_reply_to_status_id_str, place, metadata
@james-see
james-see / pyde.py
Created January 12, 2015 18:35
pyde.py
# this script takes a 26 char string that you provide and
# a cipher and converts it back to text
# it works in pythonista
import random
import sys
import string
import console
import clipboard
import webbrowser
@james-see
james-see / pyen.py
Created January 12, 2015 18:36
pyen.py
# this script takes a 26 char string that you provide and
# a phrase and turns it into a cipher
# it works in pythonista
import random
import sys
import string
import console
import clipboard
import webbrowser
@james-see
james-see / pycyplains.py
Created January 12, 2015 18:39
pycyplains.py
## PYCY
## A SIMPLE TOOL FOR SIMPLE CIPHER FOR EVERY DAY OF THE MONTH in plaintext
## set to work in pythonista
import string
import random, sys
import calendar
import datetime
import clipboard #pythonista app
@james-see
james-see / back-to-main-button.markdown
Last active August 29, 2015 14:16
back to main button

back to main button

CSS only with hover transform effects for the button resize with curved corners. This is the same button that is working on my site. Check it out on any article at https://jamescampbell.us

View the live working version on codepen as well, here is the Pen by James Campbell on CodePen.

License.

@james-see
james-see / dicts.py
Created April 11, 2015 03:44
Randomly select a word from a dictionary word list in dicts.py
diction="""List of words here"""