Skip to content

Instantly share code, notes, and snippets.

View kaanaksit's full-sized avatar

Kaan Akşit kaanaksit

View GitHub Profile
@kaanaksit
kaanaksit / androser.py
Last active August 19, 2021 01:55
Serial communication using pyjnius, Arduino Nano and USB-OTG
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = ('Kaan Akşit')
try:
import sys,time
from array import array
from jnius import autoclass
from jnius import cast
@kaanaksit
kaanaksit / HarvestLog.py
Created November 24, 2015 19:20
Way to record logs of Kivy to a different location on hard drive.
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = ('Kaan Akşit')
__version__ = '0.1'
# Importing necessary libraries.
try:
import sys,time,os,datetime,logging
from kivy.logger import Logger
@kaanaksit
kaanaksit / kernels.py
Created December 17, 2015 18:56
Here are some kernels I like to use for Machine Learning related projects.
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = ('Kaan Akşit')
__version__ = '0.1'
# Importing necessary libraries.
try:
import sys,glob,time,copy
import numpy as np
@kaanaksit
kaanaksit / dancing_bulb.py
Last active January 5, 2020 07:28
Dance of a Smart bulb with music
'''
This is tested with an Ubuntu 19.10. I tested this script with %60 volume and a Bistee Smart WiFi Bulb E26 7W RGBW --> https://smile.amazon.com/gp/product/B07YDKD274/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
(1) Assuming that you set the default input device on your machine as monitor of your soundcard (check input devices in `pavucontrol`).
(2) Assuming that you installed sounddevice, flux_led using pip3: sudo pip3 install sounddevice, flux_led .
(3) make sure that you set the ip address of your smart bulb correctly. Check ip_address line in this script.
(4) Simply run this script to make your light dance!
(5) If the light transition isn't good as you want, try playing with kd and kp variables in below.
'''
import sounddevice as sd
@kaanaksit
kaanaksit / trichromat lens with a phase delay
Last active February 6, 2022 02:52
A trichromat lens changing its phase delay over time looks precisely like an infinite loop. For odak visit: https://github.com/kunguz/odak
import torch
import sys
import math
from odak.learn.wave import propagate_beam, generate_complex_field, wavenumber, calculate_phase, calculate_amplitude, quadratic_phase_function
from odak.learn.tools import save_image, convolve2d
from odak.tools import check_directory, shell_command
from tqdm import tqdm
def generate(resolution, delay, distance=0.15, wavelength = 532e-9, pixel_pitch = 8e-6, propagation_type='TR Fresnel'):