This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Measure relative performance of "count overlapping substrings" functions. | |
http://hashcode.ru/questions/404985/python-%D1%85%D0%B8%D1%82%D1%80%D0%BE%D0%B5-%D0%B2%D1%85%D0%BE%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5-%D0%BF%D0%BE%D0%B4%D1%81%D1%82%D1%80%D0%BE%D0%BA%D0%B8-%D0%B2-%D1%81%D1%82%D1%80%D0%BE%D0%BA%D1%83 | |
""" | |
import re | |
def count_overlapping_substrings(haystack, needle): | |
count = 0 | |
i = -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env coffee | |
require 'colors' | |
childProcess = require 'child_process' | |
spawn = childProcess.spawn | |
program = require 'commander' | |
os = require 'os' | |
fs = require 'fs' | |
async = require 'async' | |
# Cached variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CBR_ENTRYPOINT = "https://www.cbr.ru/scripts/XML_daily.asp"; | |
/** | |
* Получаем курс ЦБ на дату | |
* | |
* @param {string} currency - код валюты | |
* @param {Date} date - день | |
* @return {Number} | |
* @customfunction | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MicexApi = {}; | |
// список id разных типов ЦБ | |
var BOARD_ID = { | |
STOCK: 'TQBR', | |
ETF: 'TQTF', | |
BONDS: 'EQOB' | |
}; | |
(function(App) { | |
var MICEX_ENTRYPOINT = 'https://iss.moex.com/iss/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SOURCE_TAB_NAME = "Портфель"; | |
var TIKER_RANGE = "A8:B120"; | |
var MICEX_RATES_PAGE_NAME = "MicexRateTickers"; | |
var MICEX_INDEX_PAGE_NAME = "IMOEX"; | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('MICEX Updater') | |
.addItem('Update Rates', 'updateRates') | |
.addItem('Update Index', 'updateMecixIndex') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ticker | datetime | close | dividend | percent | |
---|---|---|---|---|---|
NLMK | 2018-01-09 | 153.0 | 5.13 | 3.35 | |
AVAN | 2018-01-09 | 520.0 | 6.2 | 1.19 | |
KAZTP | 2018-01-08 | 84.7 | 1.0 | 1.18 | |
AKRN | 2018-01-23 | 4180.0 | 112.0 | 2.68 | |
PHOR | 2018-03-12 | 2491.0 | 21.0 | 0.84 | |
HIMCP | 2018-03-25 | 6.03 | 0.12 | 1.97 | |
GCHE | 2018-04-03 | 1310.0 | 75.07 | 5.73 | |
AGRO | 2018-04-13 | 637.0 | 16.7 | 2.62 | |
NVTK | 2018-05-03 | 770.0 | 8.0 | 1.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Фейковый npm | |
# Нужен для кэширования папки node_modules | |
# Кэш находится в папке ~/.cache/npm-inject/[sha1 хэш файла package.json]/node_modules | |
# | |
# В PATH надо добавить путь папки с фейковым npm, таким образом при выполнении команды `npm install` | |
# bash вызовет фейковый npm c параметром `install`. | |
# Фейк проверяет наличие папки [sha1 хэш файла package.json] в кэше. | |
# Если она в кэше, создаем на неё симлинк node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ENTRYPOINT = "https://www.statbureau.org/calculate-inflation-rate-json"; | |
/** | |
* Получаем инфлацию за произвольный период | |
* | |
* @param {string} country - страна (belarus, brazil, canada, european-union, eurozone, france, germany, greece, india, japan, kazakhstan, mexico, russia, spain, turkey, ukraine, united-kingdom, united-states) | |
* @param {Date} start - первый месяц, включительно | |
* @param {Date} end - последний месяц, включительно | |
* @return Получаем инфляцию за произвольный период | |
* @customfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thanks @trusktr | |
var requestSync = Meteor.wrapAsync(function(url, callback) { | |
request(url, function(error, response, body) { | |
callback(error, {response: response, body: body}) | |
}) | |
}); | |
var result = requestSync("http://google.com"); | |
console.log(result.response, result.body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body style=margin:0> | |
<canvas id=a> | |
<script> | |
// initialize 2D canvas (c) | |
// initialize game state (s) | |
// initialize keys states (u,r,d,l for directions, k for all the keyboard) | |
c=a.getContext`2d`,k=[u=r=d=l=s=0] | |
// (initialize your global variables here) |
OlderNewer