Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View sloev's full-sized avatar
https://www.buymeacoffee.com/sloev

sloev / Johannes Valbjørn sloev

https://www.buymeacoffee.com/sloev
View GitHub Profile
@sloev
sloev / esc pos
Last active August 29, 2015 14:13
#!/usr/bin/env python
'''
Created on Apr 15, 2014
@author: johannes
inspired by:
github.com/patriciogonzalezvivo/ofxThermalPrinter
and
Python library for the Adafruit Thermal Printer
python-pip
python-dev
pip install pillow
https://gist.githubusercontent.com/scruss/95c61c9a1501ada2a6c5/raw/5bcedaa64be82854163d3ffa20059df5f7c78d15/esc-pos-image-star.py
er opskrift på python esc *
-- a simple http server
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("<h1> Hello, NodeMcu.</h1>")
end)
end)
print(wifi.sta.getip())
wifi.setmode(wifi.STATION)
wifi.sta.config("Loppen Public","")
print(wifi.sta.getip())
s=net.createServer(net.TCP,180)
s:listen(2323,function(c)
function s_output(str)
if(c~=nil)
then c:send(str)
#!/bin/bash
#
# Network configuration for basic server
# ­ using '/bin/ip'
#
# Note: hostname and the lo interface are
# set up by boot.localnet
#
ip="/bin/ip"
dev=eth0
WS_INSTRUCTIONS = {}
from functools import wraps
def add_to_ws_lookup(func):
f_name = func.__name__
@wraps(func)
def wrapper(*args, **kwargs):
kwargs['this_func_name']=f_name
return func(*args, **kwargs)
tmp = wrapper
WS_INSTRUCTIONS[f_name] = tmp
import boto3, os
from requests_aws4auth import AWS4Auth
from elasticsearch import Elasticsearch, RequestsHttpConnection
creds = boto3.Session().get_credentials()
awsauth = AWS4Auth(
creds.access_key,
creds.secret_key,
"eu-west-1",
@sloev
sloev / gevent_botocore_aws_lambda.py
Created March 23, 2017 17:27
gevent with botocore example (python 2.7)
from gevent import monkey, joinall, spawn
monkey.patch_all()
import botocore.session
def invoke_lambda():
session = botocore.session.get_session()
client = session.create_client('lambda')
return client.invoke(
FunctionName='test',
spacy==2.0.0
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz
networkx>=1.11
@sloev
sloev / phrase search
Created March 15, 2018 07:18
phrase search