Skip to content

Instantly share code, notes, and snippets.

KainokiKaede

Block or report user

Report or block KainokiKaede

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View FileTransfer.py
#! python2
# APN file local installer
# Creates local HTTP server to serve APN file.
# Place APN file in the same directory of this script.
# If "address already in use" shown, re-run the script.
#
# Based on: File Transfer for Pythonista
# File Transfer for Pythonista
# ============================
# This script allows you to transfer Python files from
@KainokiKaede
KainokiKaede / CreateMarkdownHyperLink.vim
Last active Mar 13, 2019
Create Markdown hyperlink automatically. Usage: type ``:MDURL`` over a URL.
View CreateMarkdownHyperLink.vim
View DropboxSyncv2.py
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import pickle
import console
import editor
import dropbox
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
View ConcatenateGoogleCalendars.gs
// From Resources > Advanced Google Services, enable Calendar API,
// and follow the link "Google Developers Console" and enable Calendar API there, too.
//
// Original: https://github.com/kdotsaito/GAS/blob/master/calender_merge.gs
// Calendar ID to concatenate to.
var outCal_id = "@group.calendar.google.com";
// Calendar IDs to concatenate.
var inCal_ids = [
"@group.calendar.google.com",
"@group.calendar.google.com",
@KainokiKaede
KainokiKaede / moves-fetch.py
Last active May 5, 2018
These scripts fetch storyline from Moves (http://moves-app.com/) and convert it into gpx file. moves-fetch.py does the first task, and movesjson2gpx.py does the second. To execute moves-fetch.py, you have to sign in to Moves as a developer (https://dev.moves-app.com/login). For further instruction, please read the comments and the code itself. F…
View moves-fetch.py
"""
1. Go to https://dev.moves-app.com/apps and register a new app.
client_id and client_secret will be given, so paste it to the variables below.
2. `$ python moves-fetch.py --requesturl` will open the web browser.
Follow the instructions and authenticate the app.
You will be redirected to a web page with an error message.
Copy the string between `code=` and `&`.
That is your request_token, so paste it below.
3. `$ python moves-fetch.py --accesstoken` will output access token to stdout.
Copy the token and paste it below.
@KainokiKaede
KainokiKaede / AutoSendDraft.gs
Last active May 2, 2018
Automatically sends Gmail drafts with specific label.
View AutoSendDraft.gs
/*
* Inspired by: http://stackoverflow.com/a/27215474
*
* After copying the code to your own script, open Resources -> Advanced Google Services,
* 1. enable Gmail API (switch to "on"),
* 2. open the link for the Google Developers Console, and enable the Gmail API for your project.
*/
function sendMorningDrafts() {
sendLabeledDrafts("schedule/send-next-0700-0800");
@KainokiKaede
KainokiKaede / movesjson2gpx.py
Last active Jan 1, 2018
This script converts JSON file obtained from Moves Export service into gpx files.
View movesjson2gpx.py
"""
This is a simple code to convert Moves JSON file to gpx files.
Each day in JSON file will be converted into different gpx file,
one file for a single day.
If you think this behavior annoying, please feel free to rewrite the code:D
Usage: 1. Get JSON file from: http://moves-export.herokuapp.com/
2. The file you've got may have some errors to be a valid JSON file,
so do some surgery to the file.
I did `s/,\+/,/g` in Vim to delete successive commas,
View dropboxloginv2.py
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
from __future__ import absolute_import
from __future__ import print_function
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
import webbrowser
import dropbox
@KainokiKaede
KainokiKaede / BackupiOSReminders.py
Created Dec 3, 2016
Backup all reminders in iOS Reminders app, using Pythonista 3.
View BackupiOSReminders.py
import reminders
with open('BackedupReminder.txt', 'w', encoding='utf-8') as fo:
all_calendars = reminders.get_all_calendars()
fo.write('Reminder Backup\n\n')
fo.write('There are ' + str(len(reminders.get_reminders())) + ' reminders to back up.\n\n')
counter = 0
for calendar in all_calendars:
fo.write('Calendar title: ' + calendar.title + '\n')
fo.write('Calendar identifier: ' + calendar.identifier + '\n\n')
@KainokiKaede
KainokiKaede / AnkiMarkdown.py
Created Nov 17, 2016
Markdown - Anki viewer for Pythonista. Obtains a Markdown file from Dropbox, hides *em* and **strong** characters, and reveals when they are pressed. Great for remembering something.
View AnkiMarkdown.py
import editor
import markdown2
from bs4 import BeautifulSoup
import tempfile
import webbrowser
import os
# filename = editor.get_path()
filename = os.path.join(tempfile.gettempdir(),'fi.md')
You can’t perform that action at this time.