10 Şubat 2017 Cuma

Raspberry pi zero and pi3 gstreamer streaming without latency

pi@raspberrypi:~ $ more stream_working.sh 
raspivid -t 0 -w 1280 -h 720 -fps 30 -vf -b 1700000 -o - | tee YOURFILENAME.h264 | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = TARGET_IP(here is my macbook) port= 9000

sertac-MacBook-Air:~ sertac$ more get_stream_working.sh 
gst-launch-1.0 udpsrc port=9000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink

here above you can find gstreamer commands to stream live HD video from raspberry pi and save it file at the same time it is working on pi3 almost no latency but pi zero could not be fast enough for this process I saw at least 45 seconds delay

27 Kasım 2016 Pazar

AttributeError: 'Feed' object has no attribute 'contenty_type' (solved)

https://github.com/django/django/commit/5c125f63f77e169a459c11bab0f639c83fabc6e2


I had this problem when I try to upgrade my system from django 1.8 to 1.10.3

- response = HttpResponse(content_type=feedgen.mime_type)
+ response = HttpResponse(content_type=feedgen.content_type)



    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File ..../lib/python2.7/site-packages/django/contrib/syndication/views.py", line 43, in __call__
    response = HttpResponse(content_type=feedgen.contenty_type)

AttributeError: 'Feed' object has no attribute 'contenty_type'


mime_type is dead so replace mime_type with content_type in your Feed.py to resolve this issue for django 1.10

21 Kasım 2016 Pazartesi

Ubuntu listing upgradeable packages

apt list --upgradable

Fixing nginx pagespeed cache folder write problem

Fixing nginx pagespeed cache folder write problem

log

2016/11/21 11:55:03 [error] 1765#0: [ngx_pagespeed 1.10.33.6-0] /var/ngx_pagespeed_cache/v3/xxxx.com/https,3A/,2Ffileblabla,.tempT7ZURX:0:opening temp file: No such file or directory


fix

sudo chown -R www-data var/cache/mod_pagespeed

15 Eylül 2016 Perşembe

Some HackerRank Python Solutions

HackerRank ı gerçekten python öğrenim konusunda çok başarılı buldum, yeni öğrenen arkadaşlar kendilerini burada çok iyi geliştirebilirler. satırları int dizilerin dizisi yapmak
s=[]
import sys
for line in sys.stdin:
    s.append(map(int,line.split()))

output [[5, 3], [10, 2, 5], [7, 1, 0], [9, 9, 9], [1, 23, 12], [6, 5, 9], 

---

>>> from collections import Counter
>>> 
>>> myList = [1,1,2,3,4,5,3,2,3,4,2,1,2,3]
>>> print Counter(myList)
Counter({2: 4, 3: 4, 1: 3, 4: 2, 5: 1})
>>>
>>> print Counter(myList).items()
[(1, 3), (2, 4), (3, 4), (4, 2), (5, 1)]
>>> 
>>> print Counter(myList).keys()
[1, 2, 3, 4, 5]
>>> 
>>> print Counter(myList).values()
[3, 4, 4, 2, 1]

----

[1]]

-----
# Enter your code here. Read input from STDIN. Print output to STDOUT

s=[]
import sys
for line in sys.stdin:
    s.append(map(int,line.split()))
    
N,M=s[0][0],s[0][1]
K=s[N+1][0]


d={}
for i in range(1,N+1):
    d[s[i][K]]=s[i]

import collections

od = collections.OrderedDict(sorted(d.items()))
for k, v in od.iteritems(): 
    print " ".join(map(str,v))
                                    


-----
s=[]
import sys
for line in sys.stdin:
    s.append(line)
    
N=map(int,s[0].split())[0]
M=map(int,s[0].split())[1]



------
arr = map(int, raw_input().split())
filter((lambda x: x < 0), range(10))

----
import sys
for line in sys.stdin:
    s=line
   
print s[:500]


---------

import operator
import sys

s=[]
import sys
for line in sys.stdin:
    s.append(line)
    
s1=map(int,s)

print reduce(operator.add,s1)
print reduce(operator.sub,s1)
print reduce(operator.mul,s1)

----
import operator
import sys

s=[]
import sys
for line in sys.stdin:
    s.append(line)
    
s1=map(int,s)
print s1[0]//s1[1]
print s1[0]*1.0/s1[1]*1.0

----

# Enter your code here. Read input from STDIN. Print output to STDOUT
N=None
import math
import sys
for line in sys.stdin:
    N=int(line)

res=map(lambda x:x*x,range(N))

for i in res:
    print i
 
-------

def is_leap(year):
    leap = False
    
    # Write your logic here
    if year%4==0:
        leap=True
    if year%100==0:
        leap=False
    if year%400==0:
        leap=True

        
    return leap
 
-----
 
import sys
print "".join(map(str,range(1,int([line for line in sys.stdin][0])+1)))

----
# Enter your code here. Read input from STDIN. Print output to STDOUT


import operator
import sys
h=0
s=[]
import sys
for line in sys.stdin:
    s.append(line)
    
arr=map(int,s[1].split())
A=set(map(int,s[2].split()))
B=set(map(int,s[3].split()))


for i in arr:
    if i in A:
        h=h+1
    elif i in B:
        h=h-1

print h

----

# Enter your code here. Read input from STDIN. Print output to STDOUT
s=[]
import sys
for line in sys.stdin:
    s.append(map(int,line.split()))

n_shoes=s[0][0]
sizes=s[1]
number_of_customers=s[2][0]

top=0
for i in range(3,number_of_customers+3):
  try:
    if s[i][0] in sizes:
        top+=s[i][1]
        sizes.remove(s[i][0])
  except:
    pass

print top


-----

def fib(n):
    return n if n < 2 else fib(n-1) + fib(n-2)

s=[]
import sys
for line in sys.stdin:
    s.append(map(int,line.split()))

fibo=[]
for i in range(s[0][0]):
    fibo.append(fib(i))
    
print map(lambda x:x**3,fibo)

------


# Enter your code here. Read input from STDIN. Print output to STDOUT

s=[]
import sys
for line in sys.stdin:
    s.append(line.split())
    
res=[]    
for i in range(1,int(s[0][0])+1):
    op=s[i][0]
    if op in ("print","sort","pop","reverse"):
        pass
    elif op in ("append","remove"):
        val=int(s[i][1])
    elif op =="insert":
        indx=int(s[i][1])
        val=int(s[i][2])
    else:
        print op
    
    if op=="insert":
        res.insert(indx,val)
    elif op=="append":
        res.append(val)
    elif op=="print":
        print res
    elif op=="sort":
        res.sort()
    elif op=="reverse":
        res.reverse()
    elif op=="remove":
        res.remove(val)
    elif op=="pop":
        res.pop()

  
----
  # Enter your code here. Read input from STDIN. Print output to STDOUT
s=[]
import sys
for line in sys.stdin:
    s.append(map(int,line.split()))
    
tnp=s[0][0]
alt=set(s[1])



print sum(alt)*1.0/len(alt)*1.0


--------


# Enter your code here. Read input from STDIN. Print output to STDOUT
s=[]
import sys
for line in sys.stdin:
    s.append(map(int,line.split()))

if len(filter(lambda x:x<0 s="">0:
    print False
elif len(filter(lambda x:x<10 or="" s="" x="">0:
    print True
else:
    print False
     
-----------


# Enter your code here. Read input from STDIN. Print output to STDOUT
import string

s=[]
import sys
for line in sys.stdin:
    s.append(line.rstrip('\n'))
    
ALLOWED = frozenset(string.ascii_letters + string.digits + '_' + '-')
ALLOWED2 = frozenset(string.ascii_letters + string.digits)



def parse(s):
    global u,w,e
    if s.count("@") !=1 or s.count(".")!=1:
        return False
    
    try:
        username=s.split('@')[0]
        websitename=(s.split('@')[1]).split('.')[0]
        extension=s.split('.')[1]
        u,w,e=username,websitename,extension
        
        if not all(map(len,[u,w,e]))>0:
                return False
        return True
    except:
        return False

def check(mystring,x):
    return all(c in x for c in mystring)

def son3(s):
    if len(s)<=3 and len(s)>0:
        return True
    else:
        return False

print sorted(filter(lambda x:parse(x) and check(u,ALLOWED) and check(w,ALLOWED2) and son3(e),s))

10 Şubat 2016 Çarşamba

Raspberry pi zeroyu komut satırı modda otomatik wifi ye bağlama gizli ssid

http://zierfischkaefig.de/merkblaetter/raspberry-pi-edimax-ew-7811un-und-ein-verstecktes-wlan/

Bugün sipariş ettiğim raspberry pi zero elime geçti. İnanılmaz küçük bir bilgisayar ilk gördüğümdeki heyecanı şaşkınlığı herhalde hiç unutmayacağım.

 Yukardaki makaledeki ayarlar ile raspberry pi zero yu cli modda internete wifi adaptör(edimax kolay ve hızlıca tanınıyor) otomatik internete bağlayabilirsiniz

23 Ağustos 2015 Pazar

"Error creating new content types. Please make sure contenttypes " RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.

    "Error creating new content types. Please make sure contenttypes "
RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.

solution to error above ;)

delete from django_content_type
delete this line from django_migrations 37,contenttypes,0002_remove_content_type_name,2015-07-25 03:25:25.153186
python manage.py migrate contenttypes

python manage.py makemigrations
python manage.py migrate


sqlite>
sqlite> delete from django_migrations where app='contenttypes'
   ...> ;
sqlite>
sqlite>


delete from django_content_type
delete from django_migrations where name = '0002_remove_content_type_name'
python manage.py migrate contenttypes
python manage.py migrate app