Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ramunasd
ramunasd / create_torrent.sh
Created September 20, 2012 09:31
OSM latest planet file torrent create and update scripts
#!/bin/bash
#
# Downloads latest OpenStreetMap planet file and creates torrent for it.
# Based on http://osm-torrent.torres.voyager.hr/ scripts
#
# You should edit "WORKDIR=" line, and copy this script in your /etc/cron.daily
#
DEF_WORKDIR=. # you must change this, if nothing else...
DEF_FILE_TYPE=planet # "planet" or "pbfplanet" (or "changesets" for faster testing)
@ramunasd
ramunasd / gtalk.pl
Created December 10, 2012 11:31
Zabbix GTalk alert script
#!/usr/bin/perl
use strict;
use warnings;
use Net::Jabber;
use POSIX qw(strftime);
my $recip = shift @ARGV;
my $mensaje = join ("\n",@ARGV);
@ramunasd
ramunasd / zext_msmtp.sh
Last active October 13, 2015 20:18
Zabbix email alert script with TLS support
#! /bin/sh
################################################################################
# Zabbix extensions (C) 2011-* Joseph Bueno <zabbixextensions@aperto.fr>
# Published under GNU General Public License version 2 or later.
# See LICENSE.txt
#-------------------------------------------------------------------------------
# Usage:
# zext_msmtp.sh <recipient> <subject> <message>
#
# Description:
@ramunasd
ramunasd / GlobalMercator.php
Last active September 20, 2020 14:11
GlobalMercator.php provides support for converting between latitude and longitude coordinates and a “quadtree” representation that makes it easy to search a database for physically close points.
<?php
/*
GlobalMercator - part of Aggregate Map Tools
Version 1.0
Copyright (c) 2009 The Bivings Group
All rights reserved.
Author: John Bafford
http://www.bivings.com/
http://bafford.com/softare/aggregate-map-tools/
@ramunasd
ramunasd / benchmark_serializers.php
Last active December 14, 2015 08:09
Benchmark most popular PHP serializers.
<?php
$_testStrings = array(
'AK' => 'Alaska', 'AZ' => 'Arizona', 'VT' => 'Vermont',
'VA' => 'Virginia', 'AZ' => 'West Virginia',
);
$_testIntegers = array(0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 84, 144,);
$_testBooleans = array(TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE,);
@ramunasd
ramunasd / cadence.py
Last active August 20, 2023 22:23
ANT+ Garmin bike cadence and speed sensor reader
"""
Initialize a basic broadcast slave channel for listening to
an ANT+ HR monitor.
"""
import sys
import time
from ant.core import driver, node, event, message
@ramunasd
ramunasd / wmscolor.py
Created June 6, 2016 19:58
High performance python3 single color service, can work as WMS service mock.
#!/usr/bin/env python
import os
import http.server
import socketserver
from urllib.parse import urlsplit, parse_qs
from PIL import Image
class wmsHandler(http.server.BaseHTTPRequestHandler):
@ramunasd
ramunasd / update.sh
Created September 12, 2017 20:09
OSM data file update script
#!/usr/bin/env bash
DATAFILE=${DATAFILE:=data.pbf}
echo "----------"
echo "Update started: `date +%c`"
# update
rm change.osc.gz
./osmupdate $DATAFILE change.osc.gz > ./log
@ramunasd
ramunasd / stream_test.php
Created February 27, 2019 09:44
Stream test
<?php
error_reporting(-1);
ini_set('display_errors', 1);
$remote = isset($argv[1]) ? $argv[1] : 'tcp://google.com:80';
$errorString = $errorCode = null;
$contextOptions = array();
if (PHP_VERSION_ID >= 70100) {
$contextOptions['socket'] = array('tcp_nodelay' => true);

Keybase proof

I hereby claim:

  • I am ramunasd on github.
  • I am ramunas (https://keybase.io/ramunas) on keybase.
  • I have a public key ASAGGXnFC9bMHJJIlkOFgM_yAafp8ySJlxAaSDnap-RXGgo

To claim this, I am signing this object: