This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
import subprocess | |
def printToPrnter(name, city): | |
data = "^XA" \ | |
"^FO200,30^ADN,30,20^FB400,3,0,C^FD"+name+"^FS" \ | |
"^FO200,80^ADN,30,20^FB400,3,0,C^FD"+city+"^FS" \ | |
"^XZ" | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify | |
import json | |
from printToPrinter import printToPrnter | |
import textwrap | |
app = Flask(__name__) | |
@app.route('/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListNode: | |
def __init__(self, data=None, next=None): | |
self.data = data | |
self.next = next | |
def __repr__(self): | |
return repr(self.data) | |
class LinkedList: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.server import HTTPServer, BaseHTTPRequestHandler | |
import pymongo | |
import json | |
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async.waterfall([ | |
function(callback) { | |
callback(null, 'one', 'two'); | |
}, | |
function(arg1, arg2, callback) { | |
// arg1 now equals 'one' and arg2 now equals 'two' | |
callback(null, 'three'); | |
}, | |
function(arg1, callback) { | |
// arg1 now equals 'three' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dependencies | |
var async = require('async'); | |
var AWS = require('aws-sdk'); | |
var gm = require('gm') | |
.subClass({ imageMagick: true }); // Enable ImageMagick integration. | |
var util = require('util'); | |
// constants | |
var MAX_WIDTH = 100; | |
var MAX_HEIGHT = 100; |