Skip to content

Instantly share code, notes, and snippets.

#![feature(time2)]
use std::time::Instant;
use std::thread;
use std::sync::mpsc;
use std::io;
struct ScopedPerformanceBlock<'a> {
sender: &'a mpsc::Sender<u32>,
creation_time: Instant,
}
import json
import argparse
import numpy as np
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import LabelEncoder
@ashish01
ashish01 / gist:2a4a0f9b525096633ca2
Created December 18, 2014 22:01
python-flask-google-oauth-example.py
import json
from flask import Flask, url_for, redirect, session
from flask_login import (UserMixin, login_required, login_user, logout_user, current_user)
from flask_googlelogin import GoogleLogin
users = {}
app = Flask(__name__)
@ashish01
ashish01 / gist:c9ed92e8b2747941b476
Last active August 29, 2015 14:02
Bootstrap boiler plate
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Title</title>
<link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" />
@ashish01
ashish01 / PriorityQueue
Last active March 29, 2022 06:11
Minimal generic min heap and priority queue implementation in C#
/// Minimal generic min heap and priority queue implementation in C#, in less than 100 lines of code
using System;
using System.Collections.Generic;
class MinHeap<T> where T : IComparable<T>
{
private List<T> array = new List<T>();
public void Add(T element)
from __future__ import print_function
from scipy.sparse import *
from sklearn.decomposition import TruncatedSVD
import matplotlib.pyplot as plt
from matplotlib import cm as CM
import numpy as np
import time
class Timer(object):
@ashish01
ashish01 / trie
Created October 12, 2013 09:51
Quick and dirty trie
class node:
def __init__(self):
self.is_end = False
self.table = {}
def add(self, c):
if c not in self.table:
self.table[c] = node()
return self.table[c]
<html>
<head>
<title>Styling thing</title>
<style type="text/css">
.riParent {border: 1px dotted gray}
.riTitle {font-size:larger}
.riText {font-size:smaller; font-style:italic; color: #AAAAAA; clear: both}
.riReject {}
.riAccept {}