Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Nurettin Onur TUĞCU nurettin

🏠
Working from home
View GitHub Profile
View a_rabbitmq_clone_in_100_lines_of_python_called_pique_enjoy.py
from asyncio.tasks import Task
from typing import Dict
import asyncio
from uuid import uuid4
class PiQueConnection:
def __init__(self, pique: 'PiQue', uid: str, reader: asyncio.StreamReader, writer: asyncio.StreamWriter):
self.pique = pique
self.uid = uid
View ali_nesin_cevap.py
"""
Türkçe kelimeleri hecelemek için yazdığım bir bilgisayar programı
Nurettin Onur TUĞCU - 2020
Geçen gün Türkçe'deki heceleme kurallarını incelerken Ali Nesin'in Matematik ve Sonsuz[1] isimli kitabına denk geldim.
34. sayfadaki açıklamanın sonundaki dip notta 1973 senesinden bahsedildiğine göre yazı epey eski.
Kitaptaki örnekler çok hoşuma gitti ve bütün örneklemleri çözen bir program yazmaya karar verdim.
Not 1: Ali Nesin'in de belirttiği gibi türkçeye ingilizce vb. dillerden gelen kelimelerino-ko-krem, fo-to-star) farsça
kökenli kelimelere (si-lah-şor) göre farklı hecelenmesi konusu için basit bir çözüm yok. Bu türden sözcükler için sözlük
@nurettin
nurettin / eca_fluid_sim.py
Last active Aug 16, 2020 — forked from nst/eca_fluid_sim.py
Fluid simulation from 1D cellular automata
View eca_fluid_sim.py
#!/usr/bin/env python
# Idea: YankeeMinstrel
# Python code: torstengrust
# Animated GIF: Nicolas Seriot, 2017-07-01
# https://www.reddit.com/r/cellular_automata/comments/6jhdfw/i_used_1dimensional_cellular_automata_to_make_a/
from PIL import Image, ImageDraw
import os
View fener.json
{"nodes": [{"id": "ADBGR", "group": 1}, {"id": "ALARK", "group": 1}, {"id": "AKBNK", "group": 1}, {"id": "AEFES", "group": 1}, {"id": "ADANA", "group": 1}, {"id": "ADEL", "group": 1}, {"id": "ADNAC", "group": 1}, {"id": "ALCAR", "group": 1}, {"id": "AKFGY", "group": 1}, {"id": "AKMGY", "group": 1}, {"id": "AKSEL", "group": 1}, {"id": "ALCTL", "group": 1}, {"id": "ANELE", "group": 1}, {"id": "AKPAZ", "group": 1}, {"id": "AKSGY", "group": 1}, {"id": "ALGYO", "group": 1}, {"id": "AKSUE", "group": 1}, {"id": "ACSEL", "group": 1}, {"id": "ALKIM", "group": 1}, {"id": "ALBRK", "group": 1}, {"id": "AGYO", "group": 1}, {"id": "ALKA", "group": 1}, {"id": "AKCNS", "group": 1}, {"id": "AKSEN", "group": 1}, {"id": "AKSA", "group": 1}, {"id": "AKENR", "group": 1}, {"id": "ALYAG", "group": 1}, {"id": "ADESE", "group": 1}, {"id": "AFYON", "group": 1}, {"id": "ANACM", "group": 1}, {"id": "AKGRT", "group": 1}, {"id": "AKGUV", "group": 1}, {"id": "ANELT", "group": 1}, {"id": "ANSGR", "group": 1}, {"id": "ARMDA", "group": 1}, {"
View data.json
{"nodes": [{"id": "ADBGR", "group": 1}, {"id": "ALARK", "group": 1}, {"id": "AKBNK", "group": 1}, {"id": "AEFES", "group": 1}, {"id": "ADANA", "group": 1}, {"id": "ADEL", "group": 1}, {"id": "ADNAC", "group": 1}, {"id": "ALCAR", "group": 1}, {"id": "AKFGY", "group": 1}, {"id": "AKMGY", "group": 1}, {"id": "AKSEL", "group": 1}, {"id": "ALCTL", "group": 1}, {"id": "ANELE", "group": 1}, {"id": "AKPAZ", "group": 1}, {"id": "AKSGY", "group": 1}, {"id": "ALGYO", "group": 1}, {"id": "AKSUE", "group": 1}, {"id": "ACSEL", "group": 1}, {"id": "ALKIM", "group": 1}, {"id": "ALBRK", "group": 1}, {"id": "AGYO", "group": 1}, {"id": "ALKA", "group": 1}, {"id": "AKCNS", "group": 1}, {"id": "AKSEN", "group": 1}, {"id": "AKSA", "group": 1}, {"id": "AKENR", "group": 1}, {"id": "ALYAG", "group": 1}, {"id": "ADESE", "group": 1}, {"id": "AFYON", "group": 1}, {"id": "ANACM", "group": 1}, {"id": "AKGRT", "group": 1}, {"id": "AKGUV", "group": 1}, {"id": "ANELT", "group": 1}, {"id": "ANSGR", "group": 1}, {"id": "ARMDA", "group": 1}, {"
@nurettin
nurettin / holyshit.sql
Created Apr 4, 2020
declarative json postgresql
View holyshit.sql
select row_to_json(q) from (
select
row_to_json(a) account
, json_agg(t) trades
from pm_account a
left join lateral (
select
row_to_json(t) trade
, json_agg(d) dailies
, json_agg(sf) smartorders
View async_keyboard_example.py
import asyncio
class Prompt:
def __init__(self, loop=None):
self.loop = loop or asyncio.get_event_loop()
self.q = asyncio.Queue(loop=self.loop)
self.loop.add_reader(sys.stdin, self.got_input)
def got_input(self):
asyncio.ensure_future(self.q.put(sys.stdin.readline()), loop=self.loop)
View raspivid service
#!/bin/sh
/usr/bin/raspivid --brightness 65 --saturation 25 -ex auto -n -ih -t 0 -rot 75 -w 1480 -h 1200 -fps 15 -b 1000000 -o - | /usr/bin/ncat -lkv4 5001
@nurettin
nurettin / art.sql
Created May 9, 2018
group rows by pilot row, show line numbers and line count
View art.sql
select
i
, c
, g
, gi
, sum(1) over (partition by g) gn
from (
select
i
, c
@nurettin
nurettin / Gemfile
Last active Feb 10, 2018
simple solution to einstein's riddle (also known as zebra puzzle)
View Gemfile
source "https://rubygems.org"
gem "csp-solver"
gem "terminal-table"