Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Vancl tuxmartin

View GitHub Profile
@tuxmartin
tuxmartin / Test.py
Created Jun 10, 2015
Python ORM example (Python + SQLAlchemy + SQlite/MySQL)
View Test.py
from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy import *
#from sqlalchemy.orm import *
# Pro entity v podadresari. Podaresar *musi* obsahovat prazdny soubor __init__.py !
#from entity.User import User
'''
Zavislosti:
# apt-get install python-sqlalchemy
@tuxmartin
tuxmartin / socket_client.py
Last active Apr 11, 2020
Python socket - server and client example (push notifications)
View socket_client.py
import socket
host = 'localhost'
port = 1234
buf = 1024
clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.connect((host, port))
print "Sending 'test1\\n'"
@tuxmartin
tuxmartin / ESP8266.txt
Last active Feb 2, 2020
ESP8266 - co koupit + navod
View ESP8266.txt
# NodeMcu DevKit - doporucuji na pocatecni vyuku s ESP8266!!!
New Wireless module CH340 NodeMcu V3 Lua WIFI Internet of Things development board based ESP8266
http://www.aliexpress.com/item/NodeMcu-Lua-WIFI-development-board-based-on-the-ESP8266-Internet-of-things/32339203041.html
NodeMcu base ESP8266 testing DIY Breadboard
http://www.aliexpress.com/item/NodeMcu-base-ESP8266-testing-DIY-Breadboard/32457259665.html
#ESP8266 ESP07
@tuxmartin
tuxmartin / angee_kickstarter.py
Created Sep 23, 2015
Angee Kickstarter Notification
View angee_kickstarter.py
# http://raspi.tv/2014/programming-a-kickstarter-tracker-in-python-part-1
from urllib2 import Request, urlopen, URLError
from time import sleep
import subprocess
someurl = 'https://www.kickstarter.com/projects/tomtu/angee-the-first-truly-autonomous-home-security-sys'
old_percent= 0.0
@tuxmartin
tuxmartin / RFID_EEPROM.ino
Last active Mar 5, 2020
Arduino Mifare 13.56 MHz MFRC522 reader
View RFID_EEPROM.ino
/*
* Dump block 0 of a MIFARE RFID card using a RFID-RC522 reader
* Uses MFRC522 - Library to use ARDUINO RFID MODULE KIT 13.56 MHZ WITH TAGS SPI W AND R BY COOQROBOT.
-----------------------------------------------------------------------------
* Pin layout should be as follows:
* Signal Pin Pin Pin
* Arduino Uno Arduino Mega MFRC522 board
* ------------------------------------------------------------
* Reset 9 5 RST
* SPI SS 10 53 SDA
@tuxmartin
tuxmartin / googleTextToSpeech.py
Created Dec 4, 2015
echo "test 123" | python googleTextToSpeech.py cs
View googleTextToSpeech.py
#! /usr/bin/python
# https://github.com/tuxmartin/google-translator-text-to-speech
# !!! Pouze pro vyukove ucely! Na 99,9% porusuje licenci Googlu !!!
"""
Pouziti:
$ echo "test 123" | python googleTextToSpeech.py cs
$ echo "test 123" | python googleTextToSpeech.py en
@tuxmartin
tuxmartin / gpio_reset.sh
Last active Nov 10, 2016
Angee GPIO factory reset
View gpio_reset.sh
#!/bin/bash
export PATH=$PATH:/usr/local/bin
# Set up GPIO 3 and set to input
echo "3" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio3/direction
# Read from input
cat /sys/class/gpio/gpio3/value
@tuxmartin
tuxmartin / razeni_utf8.php
Created Dec 11, 2015
Razeni UTF-8 retezcu v PHP zacinajicich diakritickym znakem
View razeni_utf8.php
<?php
setlocale(LC_COLLATE, 'cs_CZ.utf8');
$array = array("žragsg", "chodźić", "přidać", "ágščgš", "ćehnyć", "łopjeno");
usort($array, 'strcoll');
echo "<pre>";
print_r($array);
echo "/<pre>";
View poco_uri_parser.cpp
// g++ -o poco_uri_parser poco_uri_parser.cpp -L/usr/local/lib -lPocoNet -lPocoFoundation
// http://pocoproject.org/slides/160-URIandUUID.pdf
#include "Poco/URI.h"
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
@tuxmartin
tuxmartin / Zdroj_DEB_balicku.md
Last active Jan 6, 2016
Vytvoreni DEB balicku, APT zdroje a jejich zprava
View Zdroj_DEB_balicku.md

Vytvoreni a prace s APT zdrojem

Typ zdroje

Typ trivial archive ve tvaru deb http://example.org/debian ./ je deprecated, ale nicemu to nevadi.

Dnes se maji spravne pouzivat official archive ve tvaru deb http://example.org/debian unstable main.

Vytvoreni vlastniho zdroje DEB balicku pro APT

You can’t perform that action at this time.