Skip to content

Instantly share code, notes, and snippets.

View bDrwx's full-sized avatar

Andrew Bodosov bDrwx

View GitHub Profile
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
@bDrwx
bDrwx / parse.sh
Last active October 24, 2017 20:13
parse CDR by line Parsing CDR for importing to MongoDB Janvar APP
more S170111A.txt | awk -F";" '{ print strftime("%Y-%d-%m %H:%M:%S",mktime(substr($1,2,4) " " substr($1,6,2) " " substr($1,8,2) " " substr($1,10,2) " " substr($1,12,2) " " substr($1,14,2))) "," $3 "," $7 "," $8 "," $20}'
mongoimport -d fsb -c cdr --type csv --headerline --columnsHaveTypes --file imp.p1
@bDrwx
bDrwx / HelloWorld.rb
Created January 22, 2017 20:26
Grape REST API
require 'grape'
class HelloWorld < Grape::API
format :json
helpers do
def logger
HelloWorld.logger
end
end
@bDrwx
bDrwx / main.js
Created January 22, 2017 20:28
DataTables data from REST
console.log('\'Allo \'Allo!');
$(document).ready(function() {
$('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "http://localhost:9292/hello/cdr",
"columns": [
{"data": "date"},
{"data": "caller"},
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
@bDrwx
bDrwx / services
Created December 7, 2017 18:55 — forked from mlen/services
#
# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
#
# The latest IANA port assignments can be gotten from
#
# http://www.iana.org/assignments/port-numbers
@bDrwx
bDrwx / services
Created December 7, 2017 18:55 — forked from mlen/services
#
# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
#
# The latest IANA port assignments can be gotten from
#
# http://www.iana.org/assignments/port-numbers
@bDrwx
bDrwx / test.rb
Last active February 12, 2018 20:54 — forked from Mehonoshin/test.rb
Тестовое задание №1
# В целом создание корзины магазина неплохо описано в Agile web development
# with Rails. Думаю что концепция CRUID для данного типа приложений выглядит
# более естественно. Так же хорошо вписывается в данную модель создание промежуточной
# сущности между item между корзиой и списком товаров.
# В цело данный метод слишком веоик, не интуитивен и смешивает в кучу все слои MVC.
class BasketController
def add_to_basket
# Предпочтительно оперировать понятием уникального идентификатора id
item = Item.find_by_title(params[:item_title])
-- intervals in days
SET @history_interval = 7;
SET @trends_interval = 90;
DELETE FROM alerts WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM acknowledges WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM events WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM history WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM history_uint WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
@bDrwx
bDrwx / mysql_backup.sh
Created March 11, 2018 08:57 — forked from tleish/mysql_backup.sh
Bash Script to backup all MySQL databases
#!/bin/bash
#==============================================================================
#TITLE: mysql_backup.sh
#DESCRIPTION: script for automating the daily mysql backups on development computer
#AUTHOR: tleish
#DATE: 2013-12-20
#VERSION: 0.4
#USAGE: ./mysql_backup.sh
#CRON:
# example cron for daily db backup @ 9:15 am