Skip to content

Instantly share code, notes, and snippets.

View pralhadstha's full-sized avatar

Pralhad Kumar Shrestha pralhadstha

View GitHub Profile
@pralhadstha
pralhadstha / early_stopping.py
Created August 16, 2020 03:00 — forked from stefanonardo/early_stopping.py
Early Stopping PyTorch
class EarlyStopping(object):
def __init__(self, mode='min', min_delta=0, patience=10, percentage=False):
self.mode = mode
self.min_delta = min_delta
self.patience = patience
self.best = None
self.num_bad_epochs = 0
self.is_better = None
self._init_is_better(mode, min_delta, percentage)
@pralhadstha
pralhadstha / earlystopping.py
Created July 20, 2020 10:24 — forked from ryanpeach/earlystopping.py
A Python 3 implementation of the early stopping algorithm described in the Deep Learning book by Ian Goodfellow. Untested, needs basic syntax correction.
""" Python 3 implementation of Deep Learning book early stop algorithm.
@book{Goodfellow-et-al-2016,
title={Deep Learning},
author={Ian Goodfellow and Yoshua Bengio and Aaron Courville},
publisher={MIT Press},
note={\url{http://www.deeplearningbook.org}},
year={2016}
}
"""
@pralhadstha
pralhadstha / laravel-mongodb-sentinel
Created August 7, 2017 06:45 — forked from Bodom78/laravel-mongodb-sentinel
Use the Sentinel 2.x authentication package with Laravel 5.1 and MongoDB
Work in Progress: More testing to be done.
At a glance Authentication, Activation, Throttle, Groups & Permissions seem to
be working.
Downside: Copy and modify files.
Upside: Not really much work to get it up and running.
Assumes you have Laravel 5.1, jenssegers/laravel-mongodb + session addon set up
and your app is namespaced to App/
@pralhadstha
pralhadstha / RouteLinkProviderService.ts
Created December 14, 2016 03:58 — forked from klinki/RouteLinkProviderService.ts
RouteLinkProviderService - service which maps component into its route
import {Routes, Route} from "@angular/router";
import {Injectable} from "@angular/core";
@Injectable()
export class RouteLinkProviderService {
protected routes: Routes;
protected routesByComponents = new Map<any, any>();
constructor(routes: Routes) {
@pralhadstha
pralhadstha / MailGunBasicSendMail.java
Created August 30, 2016 02:53 — forked from hpsaturn/MailGunBasicSendMail.java
Send Mail basic implementation via MailGun API and Retrofit for Android
import android.util.Base64;
import com.google.gson.Gson;
import com.hpsaturn.robotsanta.Config;
import com.hpsaturn.robotsanta.models.MailGunResponse;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.converter.GsonConverter;
import retrofit.http.Field;
gulpfile.js
const elixir = require('laravel-elixir');
require('laravel-elixir-vue');
require('laravel-elixir-vueify');
elixir.config.sourcemaps = false;
elixir(mix => {
@pralhadstha
pralhadstha / php-cs-fixer
Created August 12, 2016 10:17 — forked from mpalourdio/php-cs-fixer
@fabpot php-cs-fixer config for PhpStorm
parameters
--level=psr2 --verbose fix $FileDir$/$FileName$
working directory
$ProjectFileDir$
@pralhadstha
pralhadstha / cartalyst-sentinel-composer-update.md
Created March 20, 2016 03:04
When i did composer update after removing from class aliases and providers, it gets installed.

paladin@my-PC:~/Desktop/my-site$ composer update

php artisan clear-compiled Loading composer repositories with package information Updating dependencies (including require-dev)

  • Removing symfony/css-selector (v3.0.2)

  • Installing symfony/css-selector (v3.0.3) Loading from cache

  • Removing symfony/polyfill-mbstring (v1.1.0)

  • Installing symfony/polyfill-mbstring (v1.1.1)

@pralhadstha
pralhadstha / cartalyst-composer-install-error.md
Last active March 20, 2016 02:58
Composer install error with SentinelServiceProvider

paladin@my-PC:~/Desktop/my-site$ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.

  • Installing nikic/php-parser (v2.0.0) Loading from cache

  • Installing classpreloader/classpreloader (3.0.0) Loading from cache

@pralhadstha
pralhadstha / 4chan.py
Created February 11, 2016 10:48
4chan images downloader
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, Alexis Nootens <me@axn.io>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH