Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

Ritiek Malhotra ritiek

🌴
On vacation
View GitHub Profile
@ritiek
ritiek / mpv-socat.sh
Created Jun 3, 2019
Start a track on instances of mpv on different machines at the same time using mpv's IPC server with socat
View mpv-socat.sh
#!/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 / how_to.md
Last active May 7, 2019
Compiling source with static and shared library
View how_to.md
// bin_hello.cpp

#include "lib_hello.h"

int main() {
    hello_world();
}
@ritiek
ritiek / falling_blocks.py
Last active Mar 31, 2019
A simple (py)game with purposely messed code to teach important programming concept to newbies
View falling_blocks.py
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 / bot.au3
Created Nov 3, 2018
chrome t-rex game bot
View bot.au3
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 / GSoC18_FinalReport.md
Created Aug 11, 2018
Google Summer of Code 2018 Final Report
View GSoC18_FinalReport.md

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 / nightcore.sh
Last active Sep 12, 2020
Convert a track to nightcore
View nightcore.sh
# 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 / forker.py
Created Jun 6, 2018
Fork all your starred repositories to an organization you own
View forker.py
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 / PlasmaPy.md
Last active Mar 25, 2019
My OpenAstronomy GSoC 2018 Application
View PlasmaPy.md
@ritiek
ritiek / wolfpedia.py
Last active Apr 28, 2019
Fetch information from wolfram and wikipedia using Flask API
View wolfpedia.py
import wolframalpha
import wikipedia
from wikipedia.exceptions import DisambiguationError
from flask import Flask
app = Flask(__name__)
client = wolframalpha.Client('T27H46-H3TH6GL545')
def wolframit(query):
@ritiek
ritiek / count.sh
Last active Dec 19, 2018
Count number of lines of code in a project
View count.sh
find . -name "*.py" -type f -exec grep . {} \; | wc -l
You can’t perform that action at this time.