Skip to content

Instantly share code, notes, and snippets.

Jumping 878 489 153 901 1607 1732 538 766 377 1277 66 1828 1764 651 906 1116 312 171 1439 1384 1425 1431 479 1146 1423 857 1036 426 1970 1831 970 560 464 1032 1960 1846 1428 1266 1692 1584 1334 1204 1315 1675 1018 658 1498 1181 1470 875 722 1544 1328 863 89 1105 785 1052 432 1889 1875 1063 1858 554 1897 1206 1331 625 1616 1242 557 700 20 1626 1229 1775 148 1815 16 1920 213 50 528 743 874 285 1678 307 1385 23 1898 1537 1605 1614 1665 1746 433 982 386 1378 233 1549 302 1153 1286 145 443 1726 1342 1026 1391 1704 493 1031 684 1954 455 1419 1504 914 1367 1302 1835 1631 765 421 672 1422 1380 107 815 1604 908 77 627 919 1976 1878 1011 656 1150 1991 62 1205 224 582 961 1618 1522 1659 1774 1472 1207 1820 14 598 1476 1145 91 1450 1288 1319 239 1793 1012 37 404 134 971 1382 429 235 1306 1997 1308 1562 100 435 1249 1294 1366 1433 1091 1440 175 1864 826 1799 639 1426 1662 1827 1564 1157 1955 920 896 1810 715 612 330 1023 959 1919 735 264 114 978 616 783 1133 989 938 453 1067 284 934 291 1151 275 1292 22 550 883 5 693 1720

Keybase proof

I hereby claim:

  • I am kirel on github.
  • I am kirel (https://keybase.io/kirel) on keybase.
  • I have a public key ASAyUBlFMVnqoBrq1bRWkSVcUiyeW_uQZaw4tA_BmvAg6go

To claim this, I am signing this object:

FROM r-base:3.5.2
RUN apt-mark hold r-base-core
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcurl4-gnutls-dev \
libxml2-dev \
libmariadbclient-dev \
libssl-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
collector = function(df) {
if (!is.data.frame(df)) stop("df must be data.frame")
structure(list(df=df, accessed=list()), class = "collector")
}
`[[.collector` = function(c, attr, ...) {
c$accessed = c(c$accessed, attr)
c$df[[attr]]
}
@kirel
kirel / proxy.js
Last active May 7, 2020 06:44
Proxy for basic auth.
// Usage: USER=user PASSWORD=pw TARGET=http://localhost:3838 PORT=8080 node proxy.js
var http = require('http'),
auth = require('basic-auth'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({});
var server = http.createServer(function(req, res) {
var credentials = auth(req)
FROM cartography/osrm-backend-docker
RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository ppa:ubuntu-toolchain-r/test
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
RUN apt-get update && apt-get install -y wget nodejs g++-4.9
RUN apt-get update && apt-get remove -y lua5.1 liblua5.1-0-dev libluajit-5.1-dev \
&& apt-get autoremove -y \
&& apt-get install -y wget lua5.2 liblua5.2-dev libluabind-dev
RUN rm /usr/bin/g++ /usr/bin/gcc && ln -s /usr/bin/gcc-4.9 /usr/bin/gcc && ln -s /usr/bin/g++-4.9 /usr/bin/g++
import numpy as np
import pandas as pd
import re
from ftplib import FTP
import zipfile
import StringIO
FTP_SERVER = 'ftp-cdc.dwd.de'
PATH_HISTORICAL = 'pub/CDC/observations_germany/climate/daily/kl/historical'
PATH_RECENT = 'pub/CDC/observations_germany/climate/daily/kl/recent'
@kirel
kirel / Einwohner Wikipedia.csv
Last active February 13, 2018 13:24
Zugezogene
Rang Name 1970 1980 1990 2000 2010 2014 Bundesland
1. Berlin 3.208.719 3.048.759 3.433.695 3.382.169 3.460.725 3.469.849 Berlin
2. Hamburg 1.793.640 1.645.095 1.652.363 1.715.392 1.786.448 1.762.791 Hamburg
3. München 1.311.978 1.298.941 1.229.026 1.210.223 1.353.186 1.429.584 Bayern
4. Köln 849.451 976.694 953.551 962.884 1.007.119 1.046.680 Nordrhein-Westfalen
5. Frankfurt am Main 666.179 629.375 644.865 646.550 679.664 717.624 Hessen
6. Stuttgart 634.202 580.648 579.988 583.874 606.588 612.441 Baden-Württemberg
7. Düsseldorf 660.963 590.479 575.794 569.364 588.735 604.527 Nordrhein-Westfalen
8. Dortmund 640.642 608.297 599.055 588.994 580.444 580.511 Nordrhein-Westfalen
9. Essen 696.419 647.643 626.973 595.243 574.635 573.784 Nordrhein-Westfalen
library(rvest)
fetchPopWiki = function(query) {
tryCatch({
city <- read_html(paste0("https://www.wikipedia.de/go?q=",gsub(" ","+",query),"&l=de"))
table = city %>% html_nodes("table.infobox") %>%
html_table(fill=TRUE)
tds = city %>% html_nodes('th,td')
population = sub('([\\.0-9]+).*', '\\1', html_text(tds[grep('Einwohner|Bevölkerung', tds)[1] + 1])) # manchmal Bevölkerung
num = as.numeric(gsub('\\.','',population))
import mysql.connector
from sqlalchemy import create_engine
engine = create_engine('mysql+mysqlconnector://root:@localhost/test')
import pandas as pd
with engine.connect() as conn, conn.begin():
data = pd.read_sql_table('table', conn)
data