I hereby claim:
- I am ludwig on github.
- I am ludwig1024 (https://keybase.io/ludwig1024) on keybase.
- I have a public key whose fingerprint is 4D40 1C62 1AB8 C1D7 5C93 F20D 62F5 EA1C BD5C 7771
To claim this, I am signing this object:
| from flask import Flask, request, session | |
| from sqlalchemy import create_engine, Table, MetaData | |
| from sqlalchemy.orm import mapper, relationship, sessionmaker, scoped_session | |
| from sqlalchemy.sql import select | |
| app = Flask(__name__) | |
| engine = create_engine('postgresql+psycopg2://kamal@localhost/clinic_dev') | |
| metadata = MetaData(bind=engine) | |
| DBSession = scoped_session(sessionmaker(bind=engine)) |
| # Python OAuth example | |
| import evernote.edam.userstore.constants as UserStoreConstants | |
| import evernote.edam.type.ttypes as Types | |
| from evernote.api.client import EvernoteClient | |
| ## | |
| # Helper function to turn query string parameters into a | |
| # Python dictionary | |
| ## |
I hereby claim:
To claim this, I am signing this object:
| # Inser this snippet into your ~/.bash_profile | |
| # Set up the GPG Agent | |
| # http://fvue.nl/wiki/Debian_4.0:_Installing_gpg-agent | |
| if [ -f ${HOME}/.gpg-agent-info ] && \ | |
| kill -0 $(cut -d: -f 2 ${HOME}/.gpg-agent-info) | |
| then | |
| # Yes, '.gpg-agent-info' points to valid gpg-agent process; | |
| # Indicate gpg-agent process | |
| GPG_AGENT_INFO=$(cat ${HOME}/.gpg-agent-info | cut -c 16-) |
| #NoEnv | |
| #SingleInstance Force | |
| ; Some reading to do: | |
| ; https://www.autohotkey.com/docs/Hotkeys.htm | |
| ; https://www.autohotkey.com/docs/misc/Remap.htm | |
| ; https://www.autohotkey.com/docs/KeyList.htm | |
| ; Turn caps-lock into ctrl key (for vim & emacs) | |
| CapsLock::Ctrl |
| ''' | |
| Example code to show how it is possible to mock an entire module by patching | |
| the sys.modules dict using mock ( http://www.voidspace.org.uk/python/mock/ ). | |
| ''' | |
| from mock import patch, MagicMock | |
| def test_import_patching(): | |
| module_mock = MagicMock() | |
| with patch.dict('sys.modules', **{ |
| import Foundation | |
| // Tuple result | |
| // Get contents of directory at specified path, returning (filenames, nil) or (nil, error) | |
| func contentsOfDirectoryAtPath(path: String) -> (filenames: String[]?, error: NSError?) { | |
| var error: NSError? = nil | |
| let fileManager = NSFileManager.defaultManager() | |
| let contents = fileManager.contentsOfDirectoryAtPath(path, error: &error) |
| #!/bin/bash | |
| # | |
| # Bash must have been compiled with this ability: --enable-net-redirections | |
| # The device files below do not actually exist. | |
| # Use /dev/udp for UDP sockets | |
| exec 3<>/dev/tcp/host/port | |
| # Write to the socket as with any file descriptor | |
| echo "Write this to the socket" >&3 |