Skip to content

Instantly share code, notes, and snippets.

@shingjan
shingjan / Count Code lines
Created October 14, 2019 02:02 — forked from amitchhajer/Count Code lines
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@shingjan
shingjan / peter-thiels-cs183-startup-class-01-notes-essay.md
Created April 1, 2019 07:14 — forked from harperreed/peter-thiels-cs183-startup-class-01-notes-essay.md
Notes Essays—Peter Thiel’s CS183: Startup—Stanford, Spring 2012

Here is an essay version of my class notes from Class 1 of CS183: Startup. Errors and omissions are my own. Credit for good stuff is Peter’s entirely.

CS183: Startup—Notes Essay—The Challenge of the Future

Purpose and Preamble

/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@shingjan
shingjan / SQLQueryWithUSR.java
Created November 28, 2017 16:58
Android SQLite Implementation of Under Sampling Rate
public Cursor query(boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy,
String having, String orderBy, String limit, double underSamplingRate){
//...................rawQuery && return results.............................//
//This method would only be reliable if values in this table is $i.i.d.$ (Independent and identically distributed)
//Get the original query results first
Cursor c = queryWithFactory(null, distinct, table, columns, selection, selectionArgs,
groupBy, having, orderBy, limit);
List<Integer> column1 = new List<Integer>;
if (c.moveToFirst()){