Skip to content

Instantly share code, notes, and snippets.

View abonec's full-sized avatar

Alexander abonec

  • Russian, Moscow
View GitHub Profile
@abonec
abonec / awk-example.sh
Created July 12, 2016 08:22 — forked from raecoo/awk-example.sh
awk/grep commands for Rails log analysis
# Access number
cat production.log | grep "^Processing" | wc | awk '{print $1}'
# Each IP access number
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq -c
# Independent IP number
cat production.log | grep "^Processing" | awk '{print $4}' | uniq | wc | awk '{print $1}'
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq | wc -l
WITH prepared AS (
SELECT
issue_task_id,
MAX(stage_id) AS stage_id,
MAX(executor_id) AS executor_id,
MAX(day_id) day_id,
MAX(project_id) project_id,
MAX(area_id) area_id,
MAX(state_id) state_id,
MAX(location_id) location_id,
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Topcontrol",
"description": "Topcontrol"
},
"tags": [
{
"name": "pet",
Aug 29, 2016 07:58:37
Определение названия сети
Поиск подходящего алгоритма для сети MosMetro_Free
Версия приложения: 1.6.2-37
Подключение к сети MosMetro_Free
Проверка доступа в интернет
java.net.UnknownHostException: Unable to resolve host "wi-fi.ru": No address associated with hostname
at java.net.InetAddress.lookupHostByName(InetAddress.java:427)
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
at java.net.InetAddress.getAllByName(InetAddress.java:215)
class ContextRunner
DANGER = EntityModel.create_access_model('danger')
DANGER_ENTITY = Entity.find_by(table_name: 'danger')
include FactoryGirl::Syntax::Methods
def initialize(opts={})
opts.each do |var, value|
let(var) do
value
end
end
/***********************************************************************
* --strk@kbt.io;
***********************************************************************/
/***********************************************************************
* 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.
*
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]
/**
* 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);
@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
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: [],