Skip to content

Instantly share code, notes, and snippets.

View nicopace's full-sized avatar

Nicolás Pace nicopace

View GitHub Profile
function elementInViewport(el) {
var rect = el.getBoundingClientRect()
return rect.bottom > 0 &&
rect.right > 0 &&
rect.left < (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ &&
rect.top < (window.innerHeight || document.documentElement.clientHeight) /*or $(window).height() */ ;
}
@nicopace
nicopace / squid.conf
Created August 20, 2014 18:57
squid config
# This squidfile is useful for catching big files
#
# WELCOME TO SQUID 3.3.8
# ----------------------------
#
# This is the documentation for the Squid configuration file.
# This documentation can also be found online at:
# http://www.squid-cache.org/Doc/config/
#
# You may wish to look at the Squid home page and wiki for the
@nicopace
nicopace / index.html
Last active August 29, 2015 14:09
Testing OTP polyline decoding in javascript
<html>
<head>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<style>
#map { height: 500px; }
</style>
</head>
<body>
<div id="map"></div>
@nicopace
nicopace / bootstrap.sh
Last active August 29, 2015 14:10 — forked from keo/bootstrap.sh
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
#!/usr/bin/env python
# distance_from_shore.py: compute true distance between points
# and closest geometry.
# shaun walbridge, 2012.05.15
# TODO: no indexing used currently, could stand if performance needs
# improving (currently runs in ~1.5hr for 13k points)
from geopy import distance
# Parameter: GatewayInterface
# Default: NONE
#
# GatewayInterface is not autodetected, has no default, and must be set here.
# Set GatewayInterface to the interface on your router
# that is to be managed by Nodogsplash.
# Typically br0 for the wired and wireless lan on OpenWrt White Russian.
# May be br-lan on OpenWrt Kamikaze.
#

Keybase proof

I hereby claim:

  • I am nicopace on github.
  • I am nicopace (https://keybase.io/nicopace) on keybase.
  • I have a public key whose fingerprint is 3063 F421 4C98 0687 7D90 6D94 9D54 F817 8D0A 7F84

To claim this, I am signing this object:

var positionOrigin = {
lon: -64.4145,
lat: -31.8063,
height: 2000000
};
var positionDestination = {
lon: -64.4146,
lat: -31.8063,
height: 200
@nicopace
nicopace / syslog
Created April 10, 2017 19:53
grep kamailio /var/log/syslog
Apr 10 09:52:59 ubuntu kamailio: INFO: <core> [sctp_core.c:74]: sctp_core_check_support(): SCTP API not enabled - if you want to use it, load sctp module
Apr 10 09:52:59 ubuntu kamailio: WARNING: <core> [socket_info.c:1371]: fix_hostname(): could not rev. resolve 10.0.2.15
Apr 10 09:52:59 ubuntu kamailio: WARNING: <core> [socket_info.c:1371]: fix_hostname(): could not rev. resolve 10.0.2.15
Apr 10 09:52:59 ubuntu kamailio: INFO: <core> [tcp_main.c:4656]: init_tcp(): using epoll_lt as the io watch method (auto detected)
Apr 10 09:52:59 ubuntu kamailio[5805]: loading modules under config path: /usr/lib/x86_64-linux-gnu/kamailio/modules/
Apr 10 09:52:59 ubuntu kamailio[5805]: Listening on
Apr 10 09:52:59 ubuntu kamailio[5805]: udp: 127.0.0.1:5060
Apr 10 09:52:59 ubuntu kamailio[5805]: udp: 10.0.2.15:5060
Apr 10 09:52:59 ubuntu kamailio[5805]: tcp: 127.0.0.1:5060
Apr 10 09:52:59 ubuntu kamailio[5805]: tcp: 10.0.2.15:5060
@nicopace
nicopace / _etc_kamailio_kamailio.conf
Last active May 2, 2017 17:46
kamailio base conf with mysql configured
#!KAMAILIO
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#
# Kamailio (OpenSER) SIP Server v4.3 - default configuration script
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#