Hacks – Ashwin Sinha

Python Youtube MP3 Splitter

Python Youtube MP3 Splitter A Python program that splits mp3 files from YouTube albums into individual songs. Dependencies Python 2.7+ ffmpeg Getting Started You need to have Python 2.7+ and ffmpeg installed. Useful links: Install FFMPEG on Windows How to install FFmpeg on Ubuntu 14.04 Usage Install Python and ffmpeg. Download the album from Youtube […]

Gist – WordPress Sync

Gist – WordPress Sync This is a tale of how this very section – hacks.ash.wine works. I ❤️ Gists, and I have a habit of posting small stuff/code/discoveries/guides etc. up there so I can revisit them later. (All of my public gists : https://gist.github.com/Ashwinning) Additionally I use Gistbox, which allows me to categorize/add labels to […]

Super Simple Python Timer

Super Simple Python Timer Timer module for python to measure elapsed time. Import Copy Timer.py to the same folder as your python files. Linux wget “https://gist.githubusercontent.com/Ashwinning/313a4bed6af3f7599ac168c4de82b555/raw/Timer.py” Windows Invoke-WebRequest https://gist.githubusercontent.com/Ashwinning/313a4bed6af3f7599ac168c4de82b555/ raw/Timer.py -OutFile Timer.py Usage from Timer import Timer timer = Timer() #Initialize the timer #wash clothes for 5 seconds timer.print_time() #Print the time elapsed since Initialization […]

Getting a random point between two concentric circles in Unity3D

Getting a random point between two concentric circles in Unity3D /// <summary> /// Returns a random point in the space between two concentric circles. /// </summary> /// <param name=”minRadius”></param> /// <param name=”maxRadius”></param> /// <returns></returns> Vector3 GetRandomPointBetweenTwoCircles(float minRadius, float maxRadius) { //Get a point on a unit circle (radius = 1) by normalizing a random point […]

Getting all files of a specific type, in a specified folder using Boost. (returned in alphabetical order)

Getting all files of a specific type, in a specified folder using Boost. (returned in alphabetical order) //Accepts a path to a directory //a file extension //and a list //Puts all files matching that extension in the directory into the given list. //Sorts and returns the results void GetFilesOfTypeInDirectory(const boost::filesystem::path &directoryPath, const string &fileExtension, std::vector<boost::filesystem::path> […]