Skip to content

Instantly share code, notes, and snippets.

@sanjeevsiva17
sanjeevsiva17 / printToPrinter.py
Created May 4, 2021 10:55
Create and send zpl file to printer
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:
@sanjeevsiva17
sanjeevsiva17 / server.py
Last active December 29, 2022 03:13
Python server for zpl
from flask import Flask, request, jsonify
import json
from printToPrinter import printToPrnter
import textwrap
app = Flask(__name__)
@app.route('/')
class ListNode:
def __init__(self, data=None, next=None):
self.data = data
self.next = next
def __repr__(self):
return repr(self.data)
class LinkedList:
from http.server import HTTPServer, BaseHTTPRequestHandler
import pymongo
import json
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
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'
@sanjeevsiva17
sanjeevsiva17 / aws-async-example.js
Last active March 3, 2019 13:22
async-waterfall
// 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;