Skip to content

Instantly share code, notes, and snippets.

Naps: they're good as hell

Mikhail Popov bearloga

Naps: they're good as hell
Block or report user

Report or block bearloga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View logarithmic-time.R
# daily_stats has 5 columns used by this code: date, time_spent_10/25/50/75/90
ggplot(daily_stats) +
geom_segment(aes(x = date, xend = date, y = time_spent_10, yend = time_spent_90),
size = 1, color = "#00af89") +
geom_segment(aes(x = date, xend = date, y = time_spent_25, yend = time_spent_75),
size = 2, color = "#14866d") +
# geom_ribbon(aes(x = date, ymin = time_spent_lower, ymax = time_spent_upper), alpha = 0.3) +
# geom_line(aes(x = date, y = time_spent_middle)) +
View pavement-r.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pavement.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
bearloga / druid-csv-spec_country-all.json
Last active Nov 20, 2018
Druid ingestion spec for gzipped CSV data
View druid-csv-spec_country-all.json
"type": "index_hadoop",
"spec": {
"ioConfig": {
"type": "hadoop",
"inputSpec": {
"paths": "hdfs://analytics-hadoop/tmp/gsc-all.csv.gz",
"type": "static"
bearloga / dl2csv.R
Created Nov 9, 2017
Some code for converting an HTML description list into an R data.frame that can then be exported as a CSV.
View dl2csv.R
x <- "<dl>
<dd>Black hot drink</dd>
<dd>White cold drink</dd>
y <- read_html(x)
bearloga /
Last active Jan 3, 2018
A bash shell script that can be used to turn the current directory into an RStudio project, opening the project in RStudio after creating it.
# Usage: mkproj [projectname]
# projectname defaults to name of current directory
template="Version: 1.0\nRestoreWorkspace: Default\nSaveWorkspace: Default\nAlwaysSaveHistory: Default\n\nEnableCodeIndexing: Yes\nUseSpacesForTab: Yes\nNumSpacesForTab: 4\nEncoding: UTF-8\n\nRnwWeave: knitr\nLaTeX: pdfLaTeX"
wd=$(basename `pwd`)
if [ -z $1 ]; then
bearloga / wdqs-cocktails.R
Created Apr 21, 2017
Fetches cocktails and their ingredients from Wikidata using SPARQL and Wikidata Query Service
View wdqs-cocktails.R
cocktails <- WikidataQueryServiceR::query_wikidata('
SELECT DISTINCT ?cocktailLabel ?ingredientLabel ?instanceOfLabel ?subclassLabel
?cocktail wdt:P31/wdt:P279* wd:Q134768 .
?cocktail wdt:P186 ?ingredient .
?ingredient wdt:P279 ?subclass .
bearloga / app.R
Created Jan 24, 2017
A Shiny app with the header (title) panel fixed in place at the top as the user scrolls down.
View app.R
header <- headerPanel("Hello Shiny!")
header[[2]]$attribs$id = "header"
ui <- fluidPage(
tags$link(rel = "stylesheet", type = "text/css", href = "custom.css")
sidebarPanel(sliderInput("obs", "Number of observations:", min = 0, max = 1000, value = 500)),
bearloga /
Last active Dec 20, 2016
Rscript test.R --start_date=2016-12-01 --end_date=2016-12-02 >> test_`date +%F_%T` 2>&1

Test Run


start_date end_date omit_times disable_forecasts help
2016-12-01 2016-12-02 FALSE FALSE FALSE



Keybase proof

I hereby claim:

  • I am bearloga on github.
  • I am mikhailpopov ( on keybase.
  • I have a public key ASCf0zmMPu2vZKS1L64MOIaEEZ2n4ZsLRhW64H1k0sO5TQo

To claim this, I am signing this object:

You can’t perform that action at this time.