Skip to content

Instantly share code, notes, and snippets.

View Zverik's full-sized avatar

Ilya Zverev Zverik

View GitHub Profile
<?php
$rq_bbox = $_REQUEST['bbox'] or $rq_bbox = $_REQUEST['BBOX'];
$bbox = split(',', $rq_bbox);
$rq_w = $_REQUEST['width'] or $rq_w = $_REQUEST['WIDTH'];
$rq_h = $_REQUEST['height'] or $rq_h = $_REQUEST['HEIGHT'];
$url = "http://maps.rosreestr.ru/ArcGIS/rest/services/Cadastre/Cadastre/MapServer/export?dpi=100&transparent=true&format=png8&bbox={xmin:$bbox[0],ymin:$bbox[1],xmax:$bbox[2],ymax:$bbox[3],spatialReference:{wkid:4326}}&bboxSR=4326&imageSR=102113&size=$rq_w,$rq_h&f=image";
header('Location: ' . $url);
@Zverik
Zverik / recursive_index.pl
Created August 31, 2012 16:14
Create index.html with a list of all files
#!/usr/bin/perl
# Create index.html with a list of all files.
# Written by Ilya Zverev, licensed WTFPL.
use strict;
use POSIX qw(strftime);
use HTML::Template;
use File::Basename;
use Getopt::Long;
@Zverik
Zverik / SingleTile.js
Last active July 4, 2018 12:41
A layer for single-tile WMS layers. Displays a layer as a big picture, updates it on pan and zoom. This is a hack, made for an internal project; still waiting for https://github.com/Leaflet/Leaflet/issues/558 to be solved nicely. Example: L.singleTile('http://irs.gis-lab.info/').setParams({layers: 'landsat'}).addTo(map); (won't work, because tha…
/*
* L.SingleTile uses L.ImageOverlay to display a single-tile WMS layer.
* url parameter must accept WMS-style width, height and bbox.
*/
L.SingleTile = L.ImageOverlay.extend({
defaultWmsParams: {
service: 'WMS',
request: 'GetMap',
version: '1.1.1',
@Zverik
Zverik / Leaflet.LimitZoom.js
Created June 26, 2014 11:03
Leaflet LimitZoom plugin
// Limit leaflet map zoom to a list of variants
// Written by Ilya Zverev, licensed WTFPL
L.Map.mergeOptions({
zooms: [] // array of integers
});
L.Map.include({
_limitZoom: function (zoom) {
var zooms = this.options.zooms;
@Zverik
Zverik / osm-shields.py
Created July 4, 2014 10:36
Generate SVG shields for osm.org style
#!/usr/bin/python
# Generate SVG shields for https://github.com/gravitystorm/openstreetmap-carto
WIDTHS = {
1: 0.0, 2: 7.25, 3: 14.5, 4: 21.0,
5: 28.5, 6: 34.5, 7: 41.25, 8: 48.0,
9: 52.5, 10: 57.75, 11: 62.75
}
TYPES = { 'mot': '#7788a1', 'pri': '#bb7b7f', 'sec': '#c6ad84', 'ter': '#c4c68f' }
@Zverik
Zverik / osmradio.sh
Created September 17, 2014 19:41
PulseAudio setup for recording osm radio from skype and mic
#!/usr/bin/sh
# PulseAudio setup for recording osm radio from skype and mic
function rec_start() {
IP=127.0.0.1
PASSWORD=password
DATE=$(date +%y%m%d-%H%M)
# Initializing microphone
MIC_ID=$(pactl list short sources|grep GoMic|grep input|cut -f 1)
@Zverik
Zverik / geo.php
Created October 8, 2014 20:26
Display icecast2 listeners count by country and by city
<?php
$login = 'admin';
$password = '<password>';
$mount = '/radio';
$server = '<ip>:8000';
$url = "http://$server/admin/listclients?mount=$mount";
$opts = array('http' => array(
'method' => 'GET',
'header' => 'Authorization: Basic '.base64_encode("$login:$password")."\r\n"
));
@Zverik
Zverik / index.html
Last active May 24, 2016 15:39 — forked from anonymous/index.html
Presentation
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<style type='text/css'>
body {
font-family: 'Helvetica Neue';
background:#000;
@Zverik
Zverik / vecher2016.md
Last active October 21, 2016 08:24
Ссылки для «Вечера оживших карт»

Беспорядочная свалка, почти всё это я показал на «вечере». Есть вопросы? Задавайте на ilya@zverev.info или в телеграме.

@Zverik
Zverik / build_dmg.sh
Created November 16, 2016 15:22
Build script for a DMG file of MAPS.ME desktop
#!/bin/bash
set -e -u
OMIM_PATH="$(cd "${OMIM_PATH:-$(dirname "$0")/../..}"; pwd)"
DATA_PATH="$OMIM_PATH/data"
BUILD_PATH="$OMIM_PATH/out"
RELEASE_PATH="$BUILD_PATH/release"
source "$OMIM_PATH/tools/autobuild/detect_qmake.sh"
#rm -rf "$RELEASE_PATH"