Skip to content

Instantly share code, notes, and snippets.

@ritiek
ritiek / PlasmaPy.md
Last active March 25, 2019 13:19
My OpenAstronomy GSoC 2018 Application
@ritiek
ritiek / forker.py
Created June 6, 2018 17:37
Fork all your starred repositories to an organization you own
from github import Github
TOKEN =
ORGANIZATION =
g = Github(TOKEN)
organ = g.get_organization(ORGANIZATION)
user = g.get_user()
for repo in user.get_starred():
@ritiek
ritiek / nightcore.sh
Last active January 14, 2024 11:36
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
@ritiek
ritiek / GSoC18_FinalReport.md
Created August 11, 2018 15:14
Google Summer of Code 2018 Final Report

Google Summer of Code 2018 Final Report

My original project - to create a factory based implementation for unifying handling of different types of Plasmas, was completed sooner than expected. Here are the link to related pull requests I made during the summer.

PR Status Description
#501 Merged Raise more fitting NotImplementedError for functions that are yet to be implemented in our Plasma metaclass
#489 Merged Ind
@ritiek
ritiek / bot.au3
Created November 3, 2018 05:35
chrome t-rex game bot
HotKeySet("{F10}", "Exitter")
While 1
$color = PixelGetColor(545,229)
If $color = 5460819 Then
Send("{DOWN UP}")
Send("{UP DOWN}")
Sleep(150)
Send("{UP UP}")
Sleep(300)
@ritiek
ritiek / falling_blocks.py
Last active February 26, 2023 13:19
A simple (py)game
import pygame
import random
width, height = (450, 600)
background_color = (10,10,10)
clock = pygame.time.Clock()
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("Falling Blocks")
pygame.display.flip()
@ritiek
ritiek / how_to.md
Last active May 7, 2019 12:12
Compiling source with static and shared library
// bin_hello.cpp

#include "lib_hello.h"

int main() {
    hello_world();
}
@ritiek
ritiek / mpv-socat.sh
Created June 3, 2019 07:56
Start a track on instances of mpv on different machines at the same time using mpv's IPC server with socat
#!/bin/bash
# mpv --idle --no-video --loop --input-ipc-server=/tmp/mpvsocket
# socat /tmp/mpvsocket udp4-listen:5000,reuseaddr,fork
SOCKETS=(#"192.168.1.2:5000"
"192.168.1.3:5000"
"192.168.1.4:5000"
"192.168.1.9:5000"
"192.168.1.8:5000")
@ritiek
ritiek / change-wallpaper.py
Last active June 28, 2019 22:28
A Python cron-job that automatically sets desktop wallpapers from my Box cloud account
#!/usr/bin/python
import random
import os
import subprocess
import sys
from PIL import Image
ROOT_DIR = os.path.expanduser("~/Mount/box")
WALLPAPER_DIR = os.path.join(ROOT_DIR, "Pictures")
@ritiek
ritiek / push_switch.py
Last active July 24, 2019 08:59
Detect 4-pin push switch presses with Raspberry Pi's GPIO pins
# Code stolen shamelessly from
# https://www.raspberrypi.org/forums/viewtopic.php?p=876947&sid=44c21629719b08f74de2b3b465db8d5c#p876947
# I merely modified some bits
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
pin = 4