Skip to content

Instantly share code, notes, and snippets.

ritiek /
Last active Mar 20, 2021
Convert a track to nightcore
# Increase tempo (x1.06) and frequency (x1.25 assuming input freq. = 44100 Hz)
ffmpeg -i input.mp3 -filter:a "atempo=1.06,asetrate=44100*1.25" output.mp3
# Without tempo
ffmpeg -i input.mp3 -filter:a "asetrate=44100*1.25" output.mp3
# Create one frame .mp4 from .mp3 + .jpg
ffmpeg -i output.mp3 -i anime.jpg output.mp4
# Do above in single command
ffmpeg -i input.mp3 -i anime.jpg -filter:a "atempo=1.06,asetrate=44100*1.25" -vn output.mp4

If you have no idea what this is about. See

Dragonborn Comes


Kataware Doki

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

ritiek / hosts
Last active Jan 22, 2021
hosts file to block all GameRanger advertisements
View hosts
# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
ritiek /
Last active Dec 21, 2020
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 /
Last active Sep 8, 2020
Scan devices on LAN to get their IP, MAC and vendor name
#!/usr/bin/env python
import logging
import urllib2 as urllib
import nmap
from scapy.all import *
def scanNetwork(network):
ritiek /
Created Jul 19, 2020
mpv near lag-less real-time stream
mpv --no-cache --untimed --no-demuxer-thread --vd-lavc-threads=1 -
ritiek /
Last active Jul 10, 2020
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 But it's really hard to keep resolving dependencies.

I needed apt to fix it for me.

ritiek /
Last active Apr 10, 2020 — forked from kefir-/
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"
ritiek /
Last active Mar 28, 2020
Using FFmpeg to read input via stdin in Python
# pip install pytube3
import pytube
import urllib.request
import subprocess
content = pytube.YouTube("")
streams = content.streams.filter(only_audio=True).order_by("abr").desc()
response = urllib.request.urlopen(streams[0].url)
ritiek /
Last active Feb 3, 2020
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])