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
package taskone | |
import "testing" | |
var result []int | |
func BenchmarkShortEqualDo1(b *testing.B) { | |
var r []int |
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
package taskmanager | |
import "sync" | |
// Queue implement queue with priority | |
type Queue struct { | |
store [5]*storage | |
} | |
func NewQueue() *Queue { |
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 ( | |
db *sqlx.DB | |
testHost = os.Getenv("TEST_POSTGRES_HOST") | |
testPort, _ = strconv.Atoi(os.Getenv("TEST_POSTGRES_PORT")) | |
) | |
func TestMain(m *testing.M) { | |
var err error | |
db, err = sqlx.Open("postgres", fmt.Sprintf("postgres://postgres:secret@%s:%d/%s?sslmode=disable", testHost, testPort, "postgres")) | |
if err != nil { |
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
package main | |
import "fmt" | |
type runeRule func(rune) bool | |
type Checker struct { | |
bracesStack []rune | |
rules map[rune]runeRule | |
} |
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
# Вариант 1 - глобально создаем. вариант лучше тем что подключаемся к базе всего один раз а не тратим ресурсы каждый раз | |
bot = telebot.TeleBot("") | |
# создаем пулл из 3 соединений например | |
cnxpool = mysql.connector.pooling.MySQLConnectionPool(pool_name = "mypool", | |
pool_size = 3, | |
host="localhost", | |
user="root", | |
passwd="root", | |
port="3307", |
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
latestv=$(curl -s https://api.github.com/repos/go-swagger/go-swagger/releases/latest | jq -r .tag_name) | |
sudo curl -o /usr/local/bin/swagger -L'#' https://github.com/go-swagger/go-swagger/releases/download/$latestv/swagger_$(echo `uname`|tr '[:upper:]' '[:lower:]')_amd64 | |
sudo chmod +x /usr/local/bin/swagger |
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
/* interval between 0.00 UTC and start shift in UTC | |
d - interval between 0.00 and start shift in timezone | |
l - location, by example "Europe/Moscow" | |
*/ | |
func getIntervalToStartShift(d time.Duration, l string) (time.Duration, error) { | |
var diff time.Duration | |
location, err := time.LoadLocation(l) | |
if err != nil { | |
return diff, err | |
} |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
const MaxStream = 3 |
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
{ | |
"name": "Demo Test 2",//название теста | |
"formId": "quizful",//id формы | |
"showStartMessage": true,//показывать стартовое сообщение | |
"startMessage": "Demo 2",//Текст стартового сообщения | |
"showListQuestions": false,//Показывать кнопки с номерами вопросов |
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
<script src="js/QuizForm.js"></script> | |
<script>quiz('json_response/quiz.json',{'nameElement':'quiz-form-name'})</script> |
NewerOlder