Skip to content

Instantly share code, notes, and snippets.

@ritiek
ritiek / folder_predict.py
Last active November 6, 2022 13:23
Keras predicting on all images in a directory
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
import os
# image folder
folder_path = '/path/to/folder/'
# path to model
model_path = '/path/to/saved/model.h5'
# dimensions of images
@ritiek
ritiek / POST.md
Last active October 8, 2022 16:55
GSoC '21 Final Work Submission

Hi Everyone! I am Ritiek Malhotra (ritiek on IRC) and recently completed my undergraduate degree in Computer Science and Engineering. I participated in Google Summer of Code '21 and worked on musicbrainz_rs, a library wrapper on the MusicBrainz Web-API written for the Rust programming language.

Why MetaBrainz?

When the program was announced, I was not familiar with MetaBrainz. I've heard about MetaBrainz quite a few times before this but hadn't used any of their products. I'd been looking for Rust projects through the GSoC organizations page, and that's how I stumbled on MetaBrainz. I learnt about the MusicBrainz project and the entire concept seemed very interesting to me (and it still does!). Initially, I was a little intimidated by all the Rust concepts that musicbrainz_rs made use of - macros, traits, generics and lifetimes. I knew how to write basic Rust but not so much about these intermediate concepts. Nonetheless, I tried to learn more about the librar

@ritiek
ritiek / connect_to_wifi.py
Last active September 27, 2022 22:33
Setting up MicroPython on ESP32
import network
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect("ssid", "pass")
sta_if.isconnected()
sta_if.ifconfig()
import urequests
response = urequests.get("http://ipinfo.io")
ip_info = response.json()
@ritiek
ritiek / README.md
Last active May 10, 2021 15:39
Controlling mpris supported players (like mpsyt) on a headless Raspberry Pi with playerctl
sudo apt install -y dbus 
wget http://raspbian.raspberrypi.org/raspbian/pool/main/p/playerctl/libplayerctl-dev_2.0.1-1_armhf.deb
wget http://raspbian.raspberrypi.org/raspbian/pool/main/p/playerctl/gir1.2-playerctl-2.0_2.0.1-1_armhf.deb
wget http://raspbian.raspberrypi.org/raspbian/pool/main/p/playerctl/libplayerctl2_2.0.1-1_armhf.deb
wget http://raspbian.raspberrypi.org/raspbian/pool/main/p/playerctl/playerctl_2.0.1-1_armhf.deb
sudo dpkg -i libplayerctl-dev_2.0.1-1_armhf.deb
sudo dpkg -i gir1.2-playerctl-2.0_2.0.1-1_armhf.deb
sudo dpkg -i libplayerctl2_2.0.1-1_armhf.deb
sudo dpkg -i playerctl_2.0.1-1_armhf.deb
@ritiek
ritiek / capture.sh
Last active April 25, 2021 11:40 — forked from kefir-/capture.sh
Screen capture with audio and webcam overlay with microphone using ffmpeg
# $ pacmd list-sources|awk '/index:/ {print $0}; /name:/ {print $0}; /device\.description/ {print $0}'
# index: 0
# name: <alsa_output.pci-0000_00_02.0-platform-hdmi-lpe-audio.stereo-fallback.monitor>
# device.description = "Monitor of Atom Processor Z36xxx/Z37xxx Series Graphics & Display Stereo"
# index: 1
# name: <alsa_output.platform-bytcr_rt5640.HiFi__hw_bytcrrt5640__sink.monitor>
# device.description = "Monitor of Built-in Audio MonoSpeaker playback + Speaker playback + Headphones playback"
# * index: 2
# name: <alsa_input.platform-bytcr_rt5640.HiFi__hw_bytcrrt5640__source>
# device.description = "Built-in Audio Internal IN3 analog Mic capture + Internal IN1 analog Mic capture + Headset Mic capture + DigitalMics capture"

If you have no idea what this is about. See https://github.com/ritiek/piano-rs.

Dragonborn Comes

FG(FB) (FB)J(BK) (BK)W(GJ)BGF x2

Kataware Doki

(qu) u u (nu) trre(ct)m e

@ritiek
ritiek / cmd.sh
Created July 19, 2020 07:28
mpv near lag-less real-time stream
mpv --no-cache --untimed --no-demuxer-thread --vd-lavc-threads=1 -
@ritiek
ritiek / README.md
Last active July 10, 2020 18:49
Adding a 3rd party apt repository

I wanted to specifically install libpython3.7-dev but it wasn't available in my default apt repositories. My apt repositories had libpython3.8-dev which wouldn't work for my specific use-case.

I am on PopOS 20.04. So the corresponding debian codename would be "buster".

I noticed that it was available in https://debian.pkgs.org/10/debian-main-amd64/libpython3.7-dev_3.7.3-2+deb10u1_amd64.deb.html. But it's really hard to keep resolving dependencies.

I needed apt to fix it for me.

@ritiek
ritiek / test_led.py
Last active February 3, 2020 09:56
Tests an LED connected via GPIO to Raspberry Pi with software defined PWM
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import sys
out_pin = int(sys.argv[1])
05943f25fec2ebe063de94d615cdce54646dd31bd9b90b45fecb04f04b34079ff387bf887e64d75d050ec68643b72f2a06432be7d517ad02da050f9aff7e96fb