Skip to content

Instantly share code, notes, and snippets.

View memoryfull's full-sized avatar

Dmitriy Skougarevskiy memoryfull

  • European University at St. Petersburg
  • St. Petersburg
  • X @memoryfull
View GitHub Profile
@memoryfull
memoryfull / amplitude_time_density_example.R
Created February 23, 2017 17:49
An example of seewave::acoustat amplitude density calculation
# Install dependencies
#install.packages(c("fftw","tuneR","rgl","rpanel", "seewave"), repos="http://cran.at.r-project.org/")
# for Fast Fourier transform (fftw) to work, install
# the fftw lib (e.g. brew install fftw)
# Load libraries
library(data.table)
library(tuneR)
library(seewave)
@memoryfull
memoryfull / README.md
Created November 8, 2016 21:56
Tilegram of Russian regions

This is a tilegram of Russian regions with area being distorted according to 2015 population. I relied on Gastner and Newman, 2004 distortion algorithm. Each hexagon is approximately equal to 25,000 people. Hover over the regions to see their names and population counts (in Russian).

# (c) Dmitriy Skougarevskiy, November 2016
#
# Use of this source code is governed by the MIT license
# located at https://opensource.org/licenses/MIT

# Load dependencies
packages <- c("maptools", "raster", "sp", "rgeos", "devtools")
@memoryfull
memoryfull / README.md
Last active October 31, 2016 13:53
Optimal cycling path in Moscow

SRTM 1 second arc elevation data and optimal cycling path from the Cathedral of Christ the Saviour to the Pushkin Square in Moscow

# A proof-of-concept code to calculate
# cycling distance between two points in
# central Moscow that incorporates elevation profiles
#
# By Dmitriy Skougarevskiy, 2016-10-30
@memoryfull
memoryfull / categorizing_keywords.r
Last active October 14, 2015 16:25
Web search keyword classifier for clearspending.ru
# Install dependencies
packages <- c("data.table", "tm", "SnowballC", "Matrix", "textir")
if (length(setdiff(packages, rownames(installed.packages()))) > 0) {
install.packages(setdiff(packages, rownames(installed.packages())))
}
# Load dependencies
lapply(packages, library, character.only = TRUE)
# Path to data
@memoryfull
memoryfull / index.html
Created October 14, 2015 10:35
(Unsuccessfully) filtering Bronx from ny.json
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.tract {
fill: #ccc;
}
.tract:hover {
fill: orange;
@memoryfull
memoryfull / README.md
Created October 11, 2015 21:37
Affine transformation in d3.geo()

A demonstration of an Affine transformation in d3.geo().

For reference: an Affine transformation with same parameters in QGIS text

@memoryfull
memoryfull / README.md
Last active August 28, 2015 01:12
Stereographic Cylindrical projections of interest

A demonstration of a Stereographic Cylindrical projection of Braun (x=cosφ0×λ; y=(1+cosφ0)×tan(φ/2), where λ is the longitude, φ is the latitude, φ0 is standard parallel) under various φ0.

setwd("~/Downloads/")
library("foreign")
library("lme4")
library("lattice")
library("sandwich")
library("arm")
library("car")
library("lmtest")
# Load data
* Stata .do file to replicate the analysis in http://kashin.guru/2014/07/01/pride/ based on WVS question on national pride
* ssc inst coefplot
* Data is available at http://www.worldvaluessurvey.org/WVSDocumentationWVL.jsp (file WVS_Longitudinal_1981-2014_stata_dta_v_2014_06_17_Beta)
cd "~/Downloads/"
use WVS_Longitudinal_1981-2014_stata_dta_v_2014_06_17_Beta.dta, clear
* Generate regressors
gen male =.
replace male = 0 if X001 > 0
replace male = 1 if X001 == 1
@memoryfull
memoryfull / style.mss
Created April 14, 2014 18:28
This is a TileMill style for http://donutholes.ch base layer
// Layers used to create the basemap:
// vector: http://mapbox-geodata.s3.amazonaws.com/natural-earth-1.4.0/physical/10m-bathymetry.zip // #bathymetry layer
// http://mapbox-geodata.s3.amazonaws.com/natural-earth-1.4.0/physical/10m-ocean.zip // #ocean layer
// http://mapbox-geodata.s3.amazonaws.com/natural-earth-1.4.0/cultural/10m-admin-0-countries.zip // #countries layer
// http://mapbox-geodata.s3.amazonaws.com/natural-earth-1.4.0/cultural/10m-admin-0-countries.zip // #countries layer
// http://mapbox-geodata.s3.amazonaws.com/natural-earth-1.4.0/cultural/10m-urban-areas.zip // #urban areas layer
// raster: OB_LR/OB_LR.tif // #oceanshade (downloaded from http://www.naturalearthdata.com/downloads/10m-raster-data/10m-ocean-bottom/)
Map {
background-color: #b8dee6;
}