Skip to content

Instantly share code, notes, and snippets.

View abonec's full-sized avatar

Alexander abonec

  • Russian, Moscow
View GitHub Profile
@abonec
abonec / shared_request.go
Last active February 14, 2019 13:24
shared request
package main
import (
"net/http"
"sync"
)
type Response struct {
}
type Request struct {
@abonec
abonec / sortable.go
Created January 23, 2019 12:59
sortable
package main
import (
"fmt"
"sort"
"time"
)
type Sortable interface {
Copy() Sortable
{"color": "Orange", "annotates": [{"type": "gps_coords"}, {"type": "actor_name"}], "separator": ", "}
@abonec
abonec / plot_decision_boundary.py
Created August 15, 2017 19:42 — forked from dennybritz/plot_decision_boundary.py
plot_decision_boundary.py
# Helper function to plot a decision boundary.
# If you don't fully understand this function don't worry, it just generates the contour plot below.
def plot_decision_boundary(pred_func):
# Set min and max values and give it some padding
x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5
y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5
h = 0.01
# Generate a grid of points with distance h between them
xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))
# Predict the function value for the whole gid
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
// Initialize Wifi connection to the router
char ssid[] = "xxx"; // your network SSID (name)
char password[] = "xxx"; // your network key
// Initialize Telegram BOT
#define BOTtoken "xxx" // your Bot Token (Get from Botfather)
import React, {Component} from 'react';
import {isEqual, zip} from 'lodash';
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';
const SORT_LIMIT = 2;
class Table extends Component {
state = {
sortName: [],
@abonec
abonec / 0_reuse_code.js
Created January 11, 2017 14:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/**
* Create a new point array with no segment longer than the input segment length (expressed in radians!)
* @param pa_in - input point array pointer
* @param max_seg_length - maximum output segment length in radians
*/
static POINTARRAY*
ptarray_segmentize_sphere(const POINTARRAY *pa_in, double max_seg_length)
{
POINTARRAY *pa_out;
int hasz = ptarray_has_z(pa_in);
module Spatial::Utils
EARTH_RADIUS = 6371.0
DETAILED_THRESHOLD = 3.0 # meters
module_function
def distance(point1, point2)
point1 = to_radians(point1)
point2 = to_radians(point2)
dlat = point2[0] - point1[0]
/***********************************************************************
* [email protected];
***********************************************************************/
/***********************************************************************
* Interpolate a point along a line, useful for Geocoding applications
* SELECT line_interpolate_point( 'LINESTRING( 0 0, 2 2'::geometry, .5 )
* returns POINT( 1 1 ).
* Works in 2d space only.
*