Skip to content

Instantly share code, notes, and snippets.

View SushilShrestha's full-sized avatar
🦖
Rawr!

Sushil Shrestha SushilShrestha

🦖
Rawr!
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SushilShrestha
SushilShrestha / PMF-PDF.md
Last active January 31, 2019 01:21
Probability Mass Functions / Probability Density functions

PDF is defined by a Probability Distribution curve. PDF can be thought of like, given a sample data points, the PDF squashes the points to get a model (curve or distribution curve) that can be used to define the total samples. We can select a pdf train it on our dataset. find the pdf parameters and then use the model to predict future events. So PDF is a function p(x) that returns probability of x and uses parameters we obtained from the population.

We have freedom to choose what to use for p(x). There are multiple density functions you can choose from.

  • Bernoulli's Distribution
  • Poission's Distribution
  • Normal Distribution
  • Bionomial Distribution
  • Negative Binomial Distribution
@SushilShrestha
SushilShrestha / NepaliEvents.ics
Created January 25, 2019 06:01
Nepali calendar events
BEGIN:VCALENDAR
BEGIN:VEVENT
SUMMARY:सरस्वती पूजा (शिक्षणसंस्
था बिदा)
DTSTART;VALUE=DATE-TIME:20190210T090000
END:VEVENT
BEGIN:VEVENT
SUMMARY:विजया दशमी
DTSTART;VALUE=DATE-TIME:20181019T090000
END:VEVENT

Activity Scheduling (Dynamic approach)

The table we are going to build for this activity scheduling problem will track the number of activities we can schedule, given a list of activities sorted by finish time. We will try to maximize the number of activities we can schedule. Consider a following activities that we need to choose from. ![table][tablephoto]

We want to solve it using the dynamic approach so we create a table of (n+1) X (n+1) to store our data for the dynamic programming. Each item say c[i][j] means number of activities that can be scheduled in between activity[i] and activity[j].

Following table is the final table we get, if we use the dynamic programming to solve the above problem.

|#|0|1|2|3|4|5|6|7|8|9|10|11|

@SushilShrestha
SushilShrestha / Readme.md
Last active August 25, 2017 05:40
PP and auto size tile photo using imagemagick for a4 size printing

Usage

ppauto inputfilename

Requirements

Imagemagick

Sample

Input File

Input File

Output File

@SushilShrestha
SushilShrestha / react-native colorful console android logs.md
Last active March 28, 2017 09:05
react-native debugging logs on shell

For Linux

react-native log-android |
sed -e 's/\(.*action @ .*\)/\o033[32m\1\o033[39m/' \
    -e 's/\(.* —— log end.*\)/\o033[32m\1\o033[39m/' \
    -e 's/\(.*prev state.*\)/\o033[36m\1\o033[39m/' \
    -e 's/\(.*c action.*\)/\o033[36m\1\o033[39m/' \
    -e 's/\(.*\%c next state.*\)/\o033[36m\1\o033[39m/' \
    -e 's/\(.*W ReactNativeJS\:.*\)/\o033[33m\1\o033[39m/' \
    -e 's/\(.*E ReactNativeJS\:.*\)/\o033[31m\1\o033[39m/'