Skip to content

Instantly share code, notes, and snippets.

@mumrah
mumrah / README.md
Last active September 15, 2015 14:35 — forked from enjalot/README.md
cosine similarity

Click on the various examples

Each example is a random vector in the same "space" as the sample in the top left.

Drag on individual rows

Each row represents one dimension of our vectors. You can drag them back and forth to change the value of our vector for that dimension.

Watch how the similarity bar changes

The bar below each vector is a measure of how similar it is to the sample in the top left.

Whats going on?

@mumrah
mumrah / weather.gs
Created February 19, 2015 15:08
Script used in David's Garden Planner spreadsheet
function get_weather_conditions(year, month, day, query, apikey, cache_buster) {
if(month < 10) {
month = "0" + month;
}
if(day < 10) {
day = "0" + day;
}
var ymd = year + "" + month + "" + day;
var url = "http://api.wunderground.com/api/" + apikey + "/history_" + ymd + "/q/" + query + ".json";
[ {
"id" : "12",
"fields" : [ {
"name" : "url",
"value" : [ {
"name" : "url",
"value" : "https://lucidimagination.zendesk.com/api/v2/tickets/12.json"
} ]
}, {
"name" : "id",
@mumrah
mumrah / gist:10488740
Created April 11, 2014 18:07
Javascript to get temperature, humidity, precipitation, wind, and solr radiation from Weather Underground "history" API
function get_weather_history(year, month, day, query, apikey) {
if(month < 10) {
month = "0" + month;
}
if(day < 10) {
day = "0" + day;
}
var ymd = year + "" + month + "" + day;
var url = "http://api.wunderground.com/api/" + apikey + "/history_" + ymd + "/q/" + query + ".json";

Keybase proof

I hereby claim:

  • I am mumrah on github.
  • I am mumrah (https://keybase.io/mumrah) on keybase.
  • I have a public key whose fingerprint is 557C E8A2 3280 9E50 77A5 FE17 76D0 486F D3CE E771

To claim this, I am signing this object:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
char *memory;
void signal_handler(int signo)
{
@mumrah
mumrah / README.md
Last active December 28, 2015 06:19
Personal backup strategy

Goals

Provide onsite and offsite archiving and disaster recovery.

Onsite file sync

Synchronize several laptops and phones using BTSync to a local backup server with large attached storage (a few TB at least). Do this continuously to provide a single local backup.

Onsite snapshot backups

package foo;
public interface Feature {
public String getName();
}
[warn] Detected both new and deprecated style of plugin configuration.
[warn] Ignoring deprecated project/plugins/ directory (/Users/mumrah/Code/apache/kafka/project/plugins).
[info] Loading project definition from /Users/mumrah/Code/apache/kafka/project
[warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`).
[info] Set current project to Kafka (in build file:/Users/mumrah/Code/apache/kafka/)
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
[warn] Credentials file /Users/mumrah/.m2/.credentials does not exist
@mumrah
mumrah / ConcurrentCompositeConfigurationFactory.java
Created September 4, 2013 16:43
Example of configuring Archaius through Spring XML. Package names have been removed, so this probably won't work without some modification.
import org.apache.commons.configuration.AbstractConfiguration;
import com.netflix.config.ConcurrentCompositeConfiguration;
import java.util.ArrayList;
import java.util.List;
public class ConcurrentCompositeConfigurationFactory {
List<AbstractConfiguration> configs = new ArrayList<AbstractConfiguration>();
public void setConfigs(List<AbstractConfiguration> configs) {