Skip to content

Instantly share code, notes, and snippets.

View minkymorgan's full-sized avatar

Andrew minkymorgan

View GitHub Profile
@vst
vst / xts_json.R
Created November 23, 2011 08:32
Marshalling between xts objects and JSON representations of xts objects.
##' Declares the generic as.json method.
##'
##' @param x the object to be marshalled to JSON
##' @param ... extra arguments to the actual function
##' @return a JSON representation of the consumed object.
##' @export
as.json = function (x, ...) {
UseMethod("as.json")
}
@JerrySievert
JerrySievert / make
Created July 18, 2012 03:40
Redis on Raspberry Pi
jerry@pi:/tmp/redis-2.4.15$ make -j 2
cd src && make all
make[1]: Entering directory `/tmp/redis-2.4.15/src'
MAKE hiredis
MAKE jemalloc
make[2]: Entering directory `/tmp/redis-2.4.15/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
checking for xsltproc... no
checking for gcc... gcc
checking whether the C compiler works... yes
@tmyymmt
tmyymmt / HexBytesUtil.scala
Created September 15, 2012 09:37
hex2bytes and bytes2hex fixed
object HexBytesUtil {
def hex2bytes(hex: String): Array[Byte] = {
hex.replaceAll("[^0-9A-Fa-f]", "").sliding(2, 2).toArray.map(Integer.parseInt(_, 16).toByte)
}
def bytes2hex(bytes: Array[Byte], sep: Option[String] = None): String = {
sep match {
case None => bytes.map("%02x".format(_)).mkString
case _ => bytes.map("%02x".format(_)).mkString(sep.get)
@erichurst
erichurst / US Zip Codes from 2013 Government Data
Created December 9, 2013 23:00
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
00622,17.991245, -67.153993
@stormpython
stormpython / README.md
Last active March 21, 2022 13:45
Data Visualization with Elasticsearch Aggregations and D3 (Tutorial)

Data Visualization with Elasticsearch Aggregations and D3

Link to the Elasticsearch Blog.

@aappddeevv
aappddeevv / date dimension.md
Last active July 1, 2019 04:42
scala program to create a date time dimension CSV file for a data mart or data warehouse

You may need from time to time to grab a day-level granularity date dimension. You can find some wizards in some database packages or some PL/SQL commands to generate it, but if you just need something simple, try the below:

package datedim

import collection.JavaConverters._
import au.com.bytecode.opencsv.CSVReader
import java.io.FileReader
import scala.collection.mutable.ListBuffer
import au.com.bytecode.opencsv.CSVWriter
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@nagadomi
nagadomi / csv.lua
Last active April 28, 2020 14:52
csvigo example
-- sudo luarocks install csvigo
-- でインストールしておく
require 'csvigo'
--[[ test.csv
a,b,c,d
1,2,3,4
5,5,3,3
--]]
@karpathy
karpathy / gist:7bae8033dcf5ca2630ba
Created May 5, 2015 07:31
Efficient LSTM cell in Torch
--[[
Efficient LSTM in Torch using nngraph library. This code was optimized
by Justin Johnson (@jcjohnson) based on the trick of batching up the
LSTM GEMMs, as also seen in my efficient Python LSTM gist.
--]]
function LSTM.fast_lstm(input_size, rnn_size)
local x = nn.Identity()()
local prev_c = nn.Identity()()
local prev_h = nn.Identity()()
@ScottEvil
ScottEvil / GeoMesa_Install_Notes
Created July 20, 2015 12:46
Notes from installing GeoMesa on GeoServer and Hortonworks Sandbox
Installing GeoMesa on GeoServer
- Downloaded geoserver 2.5.2 war wget http://downloads.sourceforge.net/project/geoserver/GeoServer/2.5.2/geoserver-2.5.2-war.zip
- and the corresponding WPS plugin wget http://downloads.sourceforge.net/project/geoserver/GeoServer/2.5.2/extensions/geoserver-2.5.2-wps-plugin.zip
- Deployed war file to Tomcat_HOME/webapps folder and then copied WPS plugin jars over to WEB-INF/lib and checked to ensure permissions were good
- Download Accumulo 1.5.3 :: wget http://apache.go-parts.com/accumulo/1.5.3/accumulo-1.5.3-bin.tar.gz
- Download Scala 2.10 :: wget http://downloads.typesafe.com/scala/2.10.5/scala-2.10.5.tgz
- Download Kafka 2.10-0.8.2.1 (Kafka 0.8 install that corresponds to scala 2.10) http://ftp.wayne.edu/apache/kafka/0.8.2.1/kafka_2.10-0.8.2.1.tgz
- Download Hadoop wget http://apache.mirrors.tds.net/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
Unzip each of the downloads