This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wemos import * | |
from machine import Pin, PWM | |
import machine | |
import time | |
import urequests | |
import urandom | |
red = PWM(Pin(D8), freq=512, duty=0) | |
green = PWM(Pin(D7), freq=512, duty=0) | |
blue = PWM(Pin(D6), freq=512, duty=0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list2tuple(l): | |
"""This function takes a list and recursively changes all lists to tuples""" | |
rlist = [] | |
for i in l: | |
if type(i) in (list, tuple, set): | |
rlist.append(l2t(i)) | |
else: | |
rlist.append(i) | |
return tuple(rlist) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
dbname=$1 | |
dbuser=$2 | |
psql -c "alter database \"$dbname\" owner to \"$dbuser\"" $dbname; | |
for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" $dbname`; | |
do | |
psql -c "alter table \"$tbl\" owner to \"$dbuser\"" $dbname; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from sys import stdin | |
text = stdin.read() | |
from collections import defaultdict | |
ordered_output = defaultdict(list) | |
for line in text.split('\n'): | |
server_name = line[:line.find(':')] | |
server_output = line[line.find(':')+2:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import post | |
from os import listdir | |
for i in listdir(): | |
with open(i, "rb") as f: | |
post("http://umutkarci.com/dosyayukle", files={"file":f}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
#Disclaimer | |
- Use with caution | |
- Don't be evil | |
- Respect your users | |
""" | |
class FingerPrintMiddleware(object): | |
def process_request(self, request): | |
import hashlib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isolate(func): | |
def _func(sender, instance, **kwargs): | |
kwargs["signal"].disconnect(_func, sender=sender) | |
func(sender, instance, **kwargs) | |
kwargs["signal"].connect(_func, sender=sender) | |
return _func |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = "Umut Karci" | |
try: | |
from django.core.validators import ValidationError | |
from django.utils.translation import ugettext_lazy as _ | |
except ImportError: | |
ValidationError = Exception | |
_ = lambda x: x | |
class BitCoinAddressValidator(object): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle #ciziciyi import ediyoruz | |
def fraktal(uzunluk, derinlik): #yeni fonksyon | |
turtle.pd() #cizici cizebilsin | |
if derinlik == 0: #derinlik sifir ise, | |
turtle.forward(uzunluk) #cizici uzunluk kadar ilerlesin | |
else: #derinlik sifir degilse, | |
fraktal(uzunluk/3, derinlik-1) #fonksyon kendini cagirsin | |
for aci in [60,120,60]: #listedeki her deger sirayla aci olsun |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, subprocess | |
pyrcfile = file(os.getenv("HOME")+"/.pythonrc","w") | |
pyrcfile.write("""import rlcompleter | |
import readline | |
import os | |
readline.parse_and_bind ("bind ^I rl_complete") | |
def clear(): | |
os.system('clear')""") | |
pyrcfile.close() | |
try: |