Skip to content

Instantly share code, notes, and snippets.

@icleversoft
icleversoft / redis
Created March 1, 2013 08:57
Redis script for redis server maintenance under ubuntu distributions
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@icleversoft
icleversoft / geo_distance.rb
Created March 13, 2013 21:50
Function that calculates the distance between two points on a map
# PI = 3.1415926535
RAD_PER_DEG = 0.017453293 # PI/180
# the great circle distance d will be in whatever units R is in
Rmiles = 3956 # radius of the great circle in miles
Rkm = 6371 # radius in kilometers...some algorithms use 6367
Rfeet = Rmiles * 5282 # radius in feet
Rmeters = Rkm * 1000 # radius in meters
###Package for installation
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
sudo yum install redis -y
###Start the server
sudo service redis start
@icleversoft
icleversoft / zebra_au
Created April 29, 2013 09:35
Zebra Start/Stop Utility
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=zebra_au
DESC="Zebra Authority Server"
DAEMON=/usr/local/bin/zebrasrv
HOME=/data/zebra_au
PIDFILE=$HOME/zebra.pid
@icleversoft
icleversoft / elasticsearch
Last active December 16, 2015 19:39
ElasticSearch related
#! /bin/sh
### BEGIN INIT INFO
# Provides: elasticsearch
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts elasticsearch
# Description: Starts elasticsearch using start-stop-daemon
### END INIT INFO
@icleversoft
icleversoft / mechached
Last active December 20, 2015 03:39
memcached script for UBUNTU
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=memcached
DESC="Memcached"
USER=deploy
DAEMON=/usr/local/bin/memcached
PIDFILE=/var/run/memcached/memcached.pid
@icleversoft
icleversoft / get_locations.rb
Created September 2, 2013 07:30
Get Map Location for a given address by making use of Ggl's geocoding web service
require 'open-uri'
require 'json'
require 'ostruct'
def get_lat_lon( address, times = 0 )
url = "http://maps.google.com/maps/api/geocode/json?address=#{URI.escape(address)}&sensor=false"
#puts "Requesting: #{url}"
page = open(url).readlines.to_s
document = JSON.parse( page )
results = document["results"]
@icleversoft
icleversoft / endpoints.txt
Created September 20, 2013 13:21
Web DataSets
http://diwis.imis.athena-innovation.gr:8181/sparql xxxxx
http://wiktionary.dbpedia.org/sparql wiktionary.dbpedia.org
http://wiktionary.dbpedia.org/sparql wiktionary.dbpedia.org
http://webconf.rkbexplorer.com/sparql webconf
http://minsky.gsi.dit.upm.es/semanticwiki/index.php/Special:SPARQLEndpoint vulnerapedia
http://services.data.gov.uk/transport/sparql transport.data.gov.uk
http://services.data.gov.uk/statistics/sparql statistics.data.gov.uk
http://roni.rkbexplorer.com/sparql roni
http://foreign.rkbexplorer.com/sparql rkb-explorer-foreign
http://services.data.gov.uk/research/sparql research.data.gov.uk
@icleversoft
icleversoft / dewey.json
Last active December 23, 2015 12:49
Dewey Classification. Forked from here: http://bit.ly/16ucGA1
{
"010": {
"ru": "\u0411\u0438\u0431\u043b\u0438\u043e\u0433\u0440\u0430\u0444\u0438\u0438",
"fr": "Bibliographie",
"en": "Bibliographies",
"zh": "\u6587\u732e\u76ee\u5f55",
"pt": "Bibliografia",
"af": "Bibliografie\u00eb",
"de": "Bibliografien",
"sv": "Bibliografier",
@icleversoft
icleversoft / elasticsearch.rb
Created November 14, 2013 07:17
Elasticsearch formula for using the latest (0.90.7) version of the elasticsearch server within brew package manager 1. brew install elasticsearch 2. brew edit elasticsearch 3. replace editor's contents with the contents below 4. brew unlink elasticsearch 5. brew install elasticsearch
require 'formula'
class Elasticsearch < Formula
homepage 'http://www.elasticsearch.org'
url 'http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.tar.gz'
sha1 '6cdfe366f3496b587bf440e153567d635ab64559'
head 'https://github.com/elasticsearch/elasticsearch.git'
depends_on 'maven' if build.head?