Skip to content

Instantly share code, notes, and snippets.

What was the hottest day? Where was that?
select zip from weather where MaxTemperatureF in (select max(MaxTemperatureF) max_temp from weather);
or
select zip, date, max(MaxTemperatureF) max_temp from weather group by zip, date order by max_temp desc limit 1;
How many trips started at each station?
select start_station, count(trip_id) num_trips from trips group by start_station;
What's the shortest trip that happened?
select trip_id, duration from trips where duration in (select min(duration) from trips);
@ankuagar
ankuagar / richhickey.md
Created April 18, 2018 13:59 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@ankuagar
ankuagar / java.md
Created April 18, 2018 14:00 — forked from prakhar1989/java.md
Java Reading Notes

Java Lambdas and Closures

Chapter 1 - Intro

Google Guava Implementation of cloneWithoutNulls(List)

public static <A> List<A> cloneWithoutNulls(final List<A> list) {
 Collection<a> nonNulls = Collections2.filter(list, Predicates.notNull());</a>

Here's the prime sieve of eratosthenes implemented in 4 different functional languages.

Which one's your favorite?

OCaml
let rec range s e = if s > e then [] else s :: range (s + 1) e;;

let countprimes n =
  let rec aux count = function

Here's the prime sieve of eratosthenes implemented in 4 different functional languages.

Which one's your favorite?

OCaml
let rec range s e = if s > e then [] else s :: range (s + 1) e;;

let countprimes n =
  let rec aux count = function
@ankuagar
ankuagar / curl.md
Created September 29, 2019 17:46 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ankuagar
ankuagar / kubernetes-cheatsheet.md
Created April 21, 2020 21:10 — forked from jonashackt/kubernetes-cheatsheet.md
Kubernetes cheat sheet
@ankuagar
ankuagar / fetchbasic.sh
Last active October 31, 2020 01:00 — forked from bgeesaman/fetchbasic.sh
Obtain GKE Basic Auth Credentials and use them
#!/usr/bin/env bash
CLUSTER_NAME="basicauth"
LOCATION="--zone us-central1-a"
#LOCATION="--region us-central1"
# Get cluster metadata
echo -n "Fetching cluster metadata..."
CLUSTER="$(gcloud container clusters describe ${CLUSTER_NAME} ${LOCATION} --format=json)"
echo "done."
From: http://www.labnol.org/software/wget-command-examples/28750/
How do I download an entire website for offline viewing? How do I save all the MP3s from a website to a folder on my computer? How do I download files that are behind a login page? How do I build a mini-version of Google?
Wget is a free utility – available for Mac, Windows and Linux (included) – that can help you accomplish all this and more. What makes it different from most download managers is that wget can follow the HTML links on a web page and recursively download the files. It is the same tool that a soldier had used to download thousands of secret documents from the US army’s Intranet that were later published on the Wikileaks website.
You mirror an entire website with wget
Mirror an entire website with wget
Spider Websites with Wget – 20 Practical Examples
@ankuagar
ankuagar / Makefile
Created August 26, 2021 01:05 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)