Skip to content

Instantly share code, notes, and snippets.

@troy
troy / save-redfin-listing-images-bashrc
Created September 10, 2009 13:22
Given a redfin.com house listing URL, save all full-size images
# usage: redfin-images "http://www.redfin.com/WA/Seattle/123-Home-Row-12345/home/1234567"
function redfin-images() {
wget -O - $1 | grep "full:" | awk -F \" '{print $4}' | xargs wget -
}
@jasonrudolph
jasonrudolph / about.md
Last active May 14, 2024 16:36
Programming Achievements: How to Level Up as a Developer
@DrLulz
DrLulz / anki_html.py
Last active April 14, 2021 16:15
Grab Q/A from HTML source and create Anki Cards directly.
#!/usr/local/bin/python
import os
import sys
import csv
from operator import itemgetter
from bs4 import BeautifulSoup
from anki import Collection as aopen
usmle_rx = open("/Users/drlulz/Desktop/test.html",'r').read()
@alreich
alreich / hllx.py
Created May 11, 2015 18:50
Basic HyperLogLog: This implementation is from the website, https://github.com/Parsely/python-pds, but has been modified for pedagogical purposes to remove the dependency on the "smhasher" module and so that it can be run using the Anaconda Python distribution.
"""Basic HyperLogLog:
This implementation is from the website,
https://github.com/Parsely/python-pds, but has been modified to remove
the dependency on the "smhasher" module and so that it can be run
using the Anaconda Python distribution.
To find the modifications, look for inline comments that begin with '# !!! '
"""
@vasanthk
vasanthk / System Design.md
Last active July 22, 2024 05:05
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

package org.apache.spark.ml.feature
import org.apache.spark.ml.linalg.BLAS.axpy
import org.apache.spark.ml.linalg._
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession
import scala.util.Random
/**
@dmmiller612
dmmiller612 / KerasAttention.py
Last active June 19, 2021 08:32
Keras Sequence to Sequence LSTM with Attention Mechanism
from keras.layers.core import Permute
from keras.layers import Dense, Activation, RepeatVector, merge,Flatten, TimeDistributed, Input
from keras.layers import Embedding, LSTM
from keras.models import Model
hidden = 225
features = get_features()
outputs = get_outputs()
@erogol
erogol / NLL_OHEM.py
Last active January 29, 2023 21:02
Online hard example mining PyTorch
import torch as th
class NLL_OHEM(th.nn.NLLLoss):
""" Online hard example mining.
Needs input from nn.LogSotmax() """
def __init__(self, ratio):
super(NLL_OHEM, self).__init__(None, True)
self.ratio = ratio