Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ramūnas Dronga ramunasd

🏠
Working from home
View GitHub Profile
View keybase.md

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:

View stream_test.php
<?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);
@ramunasd
ramunasd / update.sh
Created Sep 12, 2017
OSM data file update script
View update.sh
#!/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 / wmscolor.py
Created Jun 6, 2016
High performance python3 single color service, can work as WMS service mock.
View wmscolor.py
#!/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 / cadence.py
Last active Jul 31, 2020
ANT+ Garmin bike cadence and speed sensor reader
View cadence.py
"""
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 / benchmark_serializers.php
Last active Dec 14, 2015
Benchmark most popular PHP serializers.
View benchmark_serializers.php
<?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 / GlobalMercator.php
Last active Sep 20, 2020
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.
View GlobalMercator.php
<?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 / zext_msmtp.sh
Last active Oct 13, 2015
Zabbix email alert script with TLS support
View zext_msmtp.sh
#! /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 / gtalk.pl
Created Dec 10, 2012
Zabbix GTalk alert script
View gtalk.pl
#!/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 / create_torrent.sh
Created Sep 20, 2012
OSM latest planet file torrent create and update scripts
View create_torrent.sh
#!/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)