Skip to content

Instantly share code, notes, and snippets.

View AliYmn's full-sized avatar
🐍
I'm probably writing Python right now....

Ali Yaman AliYmn

🐍
I'm probably writing Python right now....
View GitHub Profile
@AliYmn
AliYmn / adafruit_ethernet.ino
Last active February 1, 2017 23:25
Arduino ve Adafruit ile IoT
/************************* Kütüphanelerimizi ekliyelim. *********************************/
#include <SPI.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#include <Ethernet.h>
#include <EthernetClient.h>
/************************* Ethernet İşlemcisinin Kurulumu *****************************/
@AliYmn
AliYmn / python-modül-kullanımı.txt
Created December 11, 2016 15:57
Python Modül kullanımı hakkında makaleler
1-) Python Wikipedia Paketi Kullanımı
http://www.python.tc/python-wikipedia-paketi-kullanimi-ozellikleri
2-) Python ile Arduino Haberleşmesi - PySerial
http://www.python.tc/python-ile-arduino-haberlesmesi
3-) Python Kullanarak Web Siteden Veri Çekme - BeautifulSoup Kullanımı
http://www.python.tc/python-kullanarak-web-siteden-veri-cekme
4-) Python Log Tutma - logging
import wikipedia
wikipedia.set_lang("tr")
file = open("aranacaklar.txt", "r" , encoding="utf-8")
line = file.readlines()
words = line
for word in words:
print(word,' Aranıyor ...')
import wikipedia
wikipedia.set_lang("tr")
file = open("aranacaklar.txt", "r" , encoding="utf-8")
line = file.readlines()
words = line
count = 0
for word in words:
print(word,' aranıyor ...')
@AliYmn
AliYmn / func_wrap.py
Last active February 1, 2017 01:15
python @dekoratör fonksiyonlar
def arguman(arg):
def wrap(func):
def func_wrapper(name):
return "{} {}".format(arg, func(name))
return func_wrapper
return wrap
@arguman("Merhaba")
def get_text(name):
{% load mptt_tags %}
<ul>
{% recursetree nodes %}
<li>
{{ node.title }}
<br>
{{ node.image.url }}
{% if not node.is_leaf_node %}
<ul class="children">
{{ children }}
@AliYmn
AliYmn / decorator_with_arguments.py
Created February 12, 2017 13:15
decorator_with_arguments
class decorator_with_arguments():
def __init__(self, arg1, arg2, arg3):
"""
__init__ kısmı bizim constructor bölümüdür.
@decerator_with_arguments(arg1,arg2,arg3) parametrelerini alır.
"""
print("__init__() Çalıştı ...")
# Değişken atamaları yapılır.
from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class SimpleMiddleware(MiddlewareMixin):
def process_request(self, request):
pass
class SimpleMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
print('USER: {}'.format(request.user))
return response
import paho.mqtt.client as mqtt
# This is the Publisher
client = mqtt.Client()
client.connect("ip_Adress",1883,60)
client.publish("temp/random", 5)
client.disconnect()