Skip to content

Instantly share code, notes, and snippets.

View mayurbhangale's full-sized avatar

Mayur Bhangale mayurbhangale

View GitHub Profile
package com.google.engedu.ghost;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;
package com.google.engedu.ghost;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
import java.io.IOException;
import java.util.Random;
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".GhostActivity"
android:id="@+id/ghost">
<TextView
android:layout_width="wrap_content"
@mayurbhangale
mayurbhangale / dup.sh
Created April 14, 2017 07:18
./dup.sh runs the shell script ./dup.sh -h shows help along with the options(-l,-m,-d) for list,merge and delete respectively of duplicate files along with example commands
if [ "$1" = "-h" ]; then
printf "\n ./dup.sh arg1 arg2\n ./dup.sh -l <path>: for listing of duplicate files \n ./dup.sh -m <path>: for merging of duplicate files \n ./dup.sh -d <path>: for deleting of duplicate files\n Example:\n ./dup.sh -l /home/username/ will list all the duplicate files in /home/username directory \n ./dup.sh -m /home/username/ will merge all the duplicate files in /home/username directory \n ./dup.sh -d /home/username/ will delete all the duplicate files in /home/username directory\n"
elif [ -n "$2" ]; then
answer=$(find "$2" -type f -printf "%f %s\n"|sort -k1,1nr -k2,2n|uniq -d| cut -d" " -f1 )
if [ "$1" = "-l" ]; then
for i in $answer;
@mayurbhangale
mayurbhangale / birthday_corpus.py
Created April 25, 2018 10:32 — forked from wpm/birthday_corpus.py
Generate a corpus of texts mentioning birthdays that can be used to train a Prodigy named entity recognizer.
import json
import re
import time
from random import choice, random
from typing import TextIO, Callable, Sequence, Tuple, Optional
import click
NAME = DATE = str
SPAN_OFFSET = Tuple[int, int]

Audio

Make some noise and record your voice! Deep Learning models will analyze and build a drum kit, then start generating drum patterns infinitely with your sound.

Convolutional Neural Network is used to analyze and classify audio segments based on spectrograms (demo codepen) and Recurrent Neural Network(LSTM) for generating drum sequences. Shout-out to Tero Parviainen! Rhythm generation part of this codepen is based on his amazing Neural Drum Machine

Built with magenta.js, tensorflow.js and p5.js by @naotokui_en

@mayurbhangale
mayurbhangale / wiki_process.pl
Created September 10, 2018 09:18
Raw Wikipedia dump contains a lot of HTML / XML data. We pre-process it with the wiki_process.pl script.
#!/usr/bin/perl
# Program to filter Wikipedia XML dumps to "clean" text consisting only of lowercase
# letters (a-z, converted from A-Z), and spaces (never consecutive).
# All other characters are converted to spaces. Only text which normally appears
# in the web browser is displayed. Tables are removed. Image captions are
# preserved. Links are converted to normal text. Digits are spelled out.
# Written by Matt Mahoney, June 10, 2006. This program is released to the public domain.
@mayurbhangale
mayurbhangale / drawing-canvas-by-sketch-js.markdown
Created November 15, 2018 11:18
Drawing canvas by sketch.js
@mayurbhangale
mayurbhangale / csv2libsvm.py
Created November 20, 2018 16:05
Convert data to LibSVM format, supports string labels too! This is a python3 port of phraug csv2libsvm.
#!/usr/bin/env python
"""
Convert CSV file to libsvm format. Works only with numeric variables.
Put -1 as label index (argv[3]) if there are no labels in your file.
Expecting no headers. If present, headers can be skipped with argv[4] == 1.
"""
import sys
SELECT ?PermID ?hasPermId ?rank ?prefLabel ?hasReportedTitle ?hasHolder ?hasPositionType ?hasPublicationStatus ?isPositionIn ?to ?familyName ?givenName ?holdsPosition ?hasTenureInOrganization ?additionalName ?hasGender ?bday ?honorificPrefix ?from ?hasQualification ?preferredName ?honorificSuffix ?withDegree ?fromInstitutionName ?inSubject ?isTenureIn ?dateOfDeath
WHERE { OPTIONAL { ?PermID <http://permid.org/ontology/common/hasPermId> ?hasPermId }
OPTIONAL { ?PermID <http://permid.org/ontology/person/rank> ?rank }
OPTIONAL { ?PermID <http://www.w3.org/2004/02/skos/core#prefLabel> ?prefLabel }
OPTIONAL { ?PermID <http://permid.org/ontology/person/hasReportedTitle> ?hasReportedTitle }
OPTIONAL { ?PermID <http://permid.org/ontology/person/hasHolder> ?hasHolder }
OPTIONAL { ?PermID <http://permid.org/ontology/person/hasPositionType> ?hasPositionType }
OPTIONAL { ?PermID <http://permid.org/ontology/common/hasPublicationStatus> ?hasPublicationStatus }
OPTIONA