Skip to content

Instantly share code, notes, and snippets.

Avatar

Toddy Mladenov toddysm

View GitHub Profile
@toddysm
toddysm / l4-docker-registry.gist.json
Created May 11, 2021
Hierarchical Azure IoT Edge - Layer 4 Modules (OSS Registry + API Proxy)
View l4-docker-registry.gist.json
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"registry": {
"settings": {
"image": "registry:latest",
"createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5000/tcp\":[{\"HostPort\":\"5000\"}]}}}"
},
@toddysm
toddysm / nginx.conf
Created May 11, 2021
Azure IoT Edge API Proxy Configuration
View nginx.conf
events { }
http {
proxy_buffers 32 160k;
proxy_buffer_size 160k;
proxy_read_timeout 3600;
error_log /dev/stdout info;
access_log /dev/stdout;
@toddysm
toddysm / l4-connected-registry.gist.api-proxy.conn-str.json
Created May 11, 2021
Hierarchical Azure IoT Edge - Layer 4 Modules (ACR Connected Registry with Connection String and API Proxy)
View l4-connected-registry.gist.api-proxy.conn-str.json
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"connectedRegistry": {
"settings": {
"image": "10.16.7.4/acr/connected-registry:0.2.0",
"createOptions": "{\"HostConfig\":{\"Binds\":[\"/home/azureuser/connected-registry:/var/acr/data\",\"/usr/local/share/ca-certificates:/usr/local/share/ca-certificates\",\"/etc/ssl/certs:/etc/ssl/certs\"]}}"
},
@toddysm
toddysm / gist:502c9615e6215fd612c3fd4a579db661
Created Apr 16, 2021
Hierarchical Azure IoT Edge - Layer 5 Modules (ACR Connected Registry with Environment Variables Configuration)
View gist:502c9615e6215fd612c3fd4a579db661
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"connectedRegistry": {
"settings": {
"image": "mcr.microsoft.com/acr/connected-registry:0.2.0",
"createOptions": "{\"HostConfig\":{\"Binds\":[\"/home/azureuser/connected-registry:/var/acr/data\"],\"PortBindings\":{\"8080/tcp\":[{\"HostPort\":\"8080\"}]}}}"
},
@toddysm
toddysm / gist:3aec198a24cb9579299ba5728e174cd0
Created Apr 16, 2021
Hierarchical Azure IoT Edge - Layer 5 Modules (OSS Registry + API Proxy)
View gist:3aec198a24cb9579299ba5728e174cd0
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"registry": {
"settings": {
"image": "registry:latest",
"createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5000/tcp\":[{\"HostPort\":\"5000\"}]}}}"
},
@toddysm
toddysm / fix.sh
Created May 25, 2020 — forked from alexalouit/fix.sh
fix Logstash error "logstash load error: ffi/ffi -- java.lang.NullPointerException: null" on Raspbian
View fix.sh
#!/bin/bash
# based on https://github.com/mew2057/CAST/blob/6c7f7d514b7af3c512635ec145aa829c535467dc/csm_big_data/config-scripts/logstashFixupScript.sh
# see: https://github.com/elastic/logstash/issues/10755
apt-get update
apt-get install -f zip unzip
STARTDIR=$(pwd)
JARDIR="/usr/share/logstash/logstash-core/lib/jars"
@toddysm
toddysm / win-backbutton-style.html
Created Mar 25, 2013
Sample Windows 8 Page Control demonstrating how to style the back button.
View win-backbutton-style.html
<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<title>homePage</title>
<!-- WinJS references -->
<link href="//Microsoft.WinJS.1.0/css/ui-light.css" rel="stylesheet" />
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
@toddysm
toddysm / unicode.py
Last active Dec 14, 2015
Different ways to deal with Unicode strings in Python 2.x
View unicode.py
# reset the default encoding from ASCII to Unicode
# Note: it may not always work (depends on installations)
# see: http://blog.ianbicking.org/illusive-setdefaultencoding.html
import sys
reload(sys) # else the method will be missing
sys.setdefaultencoding('utf-8')
# convert from <type 'str'> to <type 'unicode'>
text.decode('utf-8')
@toddysm
toddysm / tornado_twitterhandler.py
Last active Dec 14, 2015
Twitter authentication with Tornado
View tornado_twitterhandler.py
class TwitterHandler(tornado.web.RequestHandler,
tornado.auth.TwitterMixin):
"""Handling Twitter authentication at URL http://www.yoursite.com/twitter"""
@tornado.web.asynchronous
def get(self):
if self.get_argument("oauth_token", None):
user = self.get_authenticated_user(self.async_callback(self._on_auth))
return
self.authenticate_redirect()