Skip to content

Instantly share code, notes, and snippets.

View NuniTelo's full-sized avatar
🏠
Working from home

Naun Telo NuniTelo

🏠
Working from home
  • Albania
View GitHub Profile
@aflaxman
aflaxman / gist:287370
Created January 26, 2010 23:34
networkx-osm import open street map data as a networkx graph
"""
Read graphs in Open Street Maps osm format
Based on osm.py from brianw's osmgeocode
http://github.com/brianw/osmgeocode, which is based on osm.py from
comes from Graphserver:
http://github.com/bmander/graphserver/tree/master and is copyright (c)
2007, Brandon Martin-Anderson under the BSD License
"""
@signed0
signed0 / gist:2031157
Created March 13, 2012 19:53
Google Polyline encoder & decoder
'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.
@jezhalford
jezhalford / gist:2480871
Created April 24, 2012 15:45
Map Lat/Lon onto map pixels
/**
* Convert Latitude and Longitude to CSS top and left positions for a map image.
* Works with any map image that uses Spherical Mercator Projection (the same as Google Maps)
*
* From http://stackoverflow.com/a/7021776/86780
*/
var latLonToTopLeft = function(lat, lon) {
var imageNorthLat = 59.545457; // Latitude of the image's northern edge
var imageSouthLat = 49.431947; // Latitude of the image's southern edge
/*
http://benjithian.sg/2012/12/simple-background-subtraction/
Simple Background Subtraction. Simple stuff.
*/
#include <stdio.h>
#include <curl/curl.h>
#include <sstream>
#include <iostream>
#include <vector>
#include <opencv2/opencv.hpp>
@mharsch
mharsch / gist:5188206
Last active February 8, 2024 02:43
serve HLS (HTTP Live Streaming) content from node.js

HLS streaming from node

Provided that you already have a file or stream segmenter generating your .m3u8 playlist and .ts segment files (such as the ffmpeg 'hls' muxer), this little node server will serve up those files to an HLS compatible client (e.g. Safari). If you're using node for your streaming app already, this obviates the need to serve the HLS stream from a separate web server.

loosely based on https://gist.github.com/bnerd/2011232

// loosely based on https://gist.github.com/bnerd/2011232
// requires node.js >= v0.10.0
// assumes that HLS segmenter filename base is 'out'
// and that the HLS playlist and .ts files are in the current directory
@mabdrabo
mabdrabo / sound_recorder.py
Created January 28, 2014 23:05
Simple script to record sound from the microphone, dependencies: easy_install pyaudio
import pyaudio
import wave
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
CHUNK = 1024
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "file.wav"
@rajanski
rajanski / gist:ccf65d4f5106c2cdc70e
Last active October 24, 2021 04:11 — forked from aflaxman/gist:287370
OSM to networkx graph with node coordinates ;-)
"""
Read graphs in Open Street Maps osm format
Based on osm.py from brianw's osmgeocode
http://github.com/brianw/osmgeocode, which is based on osm.py from
comes from Graphserver:
http://github.com/bmander/graphserver/tree/master and is copyright (c)
2007, Brandon Martin-Anderson under the BSD License
"""
import xml.sax
@tejpratap46
tejpratap46 / removeDuplicateFromMongoDB.js
Created July 12, 2016 11:19
Delete duplicates from mongodb
`dropDups: true` option is not available in 3.0.
I have solution with aggregation framework for collecting duplicates and then removing in one go.
It might be somewhat slower than system level "index" changes. But it is good by considering way you want to remove duplicate documents.
a. Remove all documents in one go
var duplicates = [];
@kob-to-wni
kob-to-wni / webhook-server.js
Last active September 16, 2018 14:30
Node.js Backlog WebHook server
'use strict';
const Http = require('http');
const Request = require('request');
const LISTEN_ADDRESS = '127.0.0.1';
const LISTEN_PORT = 9090;
const REQUEST_TIMEOUT = 1000;
const URL_PREFIX = '/webhook';
const PROXY = '';
@thomasdarimont
thomasdarimont / KeycloakAdminClientExample.java
Last active July 18, 2024 19:18
Using Keycloak Admin Client to create user with roles (Realm and Client level)
package demo.plain;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.CreatedResponseUtil;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.ClientRepresentation;