Skip to content

Instantly share code, notes, and snippets.

@a740122
a740122 / Kivy Aligned TextInput
Created May 21, 2017 10:40 — forked from MelleB/Kivy Aligned TextInput
Kivy Aligned Text Input - halign + valign for TextInput
Note: This just aligns the position of the textblock, not the text itself.
@a740122
a740122 / gist:00f5e0732ba583be98cca95d00d88731
Created May 18, 2017 13:02 — forked from splanquart/gist:1358169
Kivy : create image from pdf page
import PythonMagick
from pyPdf import PdfFileWriter,PdfFileReader
input1 = PdfFileReader(file('/home/steph/menu.pdf', 'rb'))
p2=input1.getPage(1)
writer=PdfFileWriter()
writer.addPage(p2)
import io
f=io.BytesIO()
writer.write(f)
blob=pm.Blob(f.read())
@a740122
a740122 / mosquitto
Created March 25, 2017 13:05 — forked from DaveThw/mosquitto
init.d script for mosquitto (on a Raspberry Pi)
#!/bin/bash
### BEGIN INIT INFO
# Provides: mosquitto
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the mosquitto service
### END INIT INFO
@a740122
a740122 / puller.py
Created March 19, 2017 11:12 — forked from thoas/puller.py
Migration script from MySQL to PostgreSQL via SQLAlchemy
#!/usr/bin/env python
import getopt
import sys
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.dialects.mysql.base import TINYINT
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import ProgrammingError
#!/bin/python
#
# Connects to a Wifi network
#
import os
def commandExists(command):
def canExecute(file):
return os.path.isfile(file) and os.access(file, os.X_OK)
@a740122
a740122 / device.py
Created September 28, 2016 01:23 — forked from espeed/device.py
Python ZeroMQ Streamer Device
import time
import zmq
from zmq.devices.basedevice import ProcessDevice
from multiprocessing import Process, Pool
def create_socket(socket_type,uri):
context = zmq.Context()
socket = context.socket(socket_type)
socket.connect(uri)
from ctypes import WINFUNCTYPE, windll
from ctypes.wintypes import BOOL, DWORD
import zmq
kernel32 = windll.LoadLibrary('kernel32')
PHANDLER_ROUTINE = WINFUNCTYPE(BOOL, DWORD)
SetConsoleCtrlHandler = kernel32.SetConsoleCtrlHandler
@a740122
a740122 / api.py
Created April 3, 2016 08:09 — forked from alanhamlett/api.py
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
@a740122
a740122 / fileBrowserHandler.htm
Created March 7, 2016 12:16 — forked from greenido/fileBrowserHandler.htm
Simple test to FileSystem APIs (HTML5)
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>Chrome File API tester</title>
<script>
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
@a740122
a740122 / bluetooth.py
Created February 29, 2016 16:32 — forked from tito/bluetooth.py
Bluetooth example on Android using Python / Pyjnius
'''
Bluetooth/Pyjnius example
=========================
This was used to send some bytes to an arduino via bluetooth.
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't
tested without BLUETOOTH_ADMIN, maybe it works.)
Connect your device to your phone, via the bluetooth menu. After the
pairing is done, you'll be able to use it in the app.