Skip to content

Instantly share code, notes, and snippets.

@virantha
virantha / _auth.py
Last active October 24, 2019 02:25
Uploading PDFS to Evernote using the Python API
def _connect_to_evernote(self, dev_token):
user = None
try:
self.client = EvernoteClient(token=dev_token)
self.user_store = self.client.get_user_store()
user = self.user_store.getUser()
except EDAMUserException as e:
err = e.errorCode
print("Error attempting to authenticate to Evernote: %s - %s" % (EDAMErrorCode._VALUES_TO_NAMES[err], e.parameter))
return False
@virantha
virantha / change_password.yml
Last active April 3, 2019 13:49
rpi setup ansible
- hosts: all
remote_user: pi
become_method: sudo
vars_prompt:
- name: new_password
prompt: "Enter the password you would like to use for the user pi"
confirm: yes
tasks:
- name: backup shadow file
@virantha
virantha / chp.py
Last active October 1, 2017 19:32
Palindrome checker
from curio import Queue, CancelledError
class Port:
def __init__(self):
self.chan = None
self.proc = None
class InputPort(Port):
async def recv(self):
tok, timestamp = await self.chan.recv()
from curio import Queue, CancelledError
class Port:
def __init__(self):
self.chan = None
self.proc = None
class InputPort(Port):
async def recv(self):
tok, timestamp = await self.chan.recv()
from curio import Queue, CancelledError
class Port:
def __init__(self):
self.chan = None
class InputPort(Port):
async def recv(self):
tok = await self.chan.recv()
return tok
@virantha
virantha / process_buffer2.py
Last active September 28, 2017 03:53
process_buffer2.py
from curio import Queue, CancelledError
class Port:
def __init__(self):
self.chan = None
class InputPort(Port):
async def recv(self):
tok = await self.chan.recv()
return tok
from curio import Queue, CancelledError
class Port:
def __init__(self):
self.chan = None
class InputPort(Port):
async def recv(self):
tok = await self.chan.recv()
return tok
class Process:
next_id = 0
def __init__(self, name):
self.name = name
self.id = Process.next_id
Process.next_id += 1
@virantha
virantha / -
Created September 22, 2017 16:44
import curio
@virantha
virantha / Main.java
Created December 2, 2016 19:47
Bundling Python with Moneydance Extensions
package com.moneydance.modules.features.myextension;
import com.moneydance.apps.md.controller.FeatureModule;
import com.moneydance.apps.md.controller.FeatureModuleContext;
import com.moneydance.apps.md.controller.ModuleUtil;
import com.moneydance.apps.md.controller.UserPreferences;
import java.io.*;
import java.util.*;
import java.text.*;