Skip to content

Instantly share code, notes, and snippets.

View v-kolesnikov's full-sized avatar
✍️
I'm writing something just now! You can write me too! 😉

Vasily Kolesnikov v-kolesnikov

✍️
I'm writing something just now! You can write me too! 😉
View GitHub Profile
/**
* @brief executeQueriesFromFile Read each line from a .sql QFile
* (assumed to not have been opened before this function), and when ; is reached, execute
* the SQL gathered until then on the query object. Then do this until a COMMIT SQL
* statement is found. In other words, this function assumes each file is a single
* SQL transaction, ending with a COMMIT line.
*/
void executeQueriesFromFile(QFile *file, QSqlQuery *query)
{

Конфиги

Навигация

Различные способы перехода в режим вставки

i " вставить текст до курсора

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@v-kolesnikov
v-kolesnikov / Dockerfile
Created January 27, 2016 15:00 — forked from mokevnin/Dockerfile
python handler for battle.hexlet.io
FROM hexlet/hexlet-base
RUN apt-install python-pip python-dev
RUN apt-install python3-pip python3-dev
RUN pip3 install pytest
ENV PYTHONDONTWRITEBYTECODE 1
@v-kolesnikov
v-kolesnikov / 00_destructuring.md
Created February 6, 2016 17:28 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors

@v-kolesnikov
v-kolesnikov / slack.clj
Created March 10, 2016 14:05 — forked from mikebroberts/slack.clj
Send a message to Slack incoming webhook in Clojure.
(ns slack
(:require [clj-http.client :as client]
[clojure.data.json :as json]))
(defn send-to-slack
"Sends a simple message to slack using an 'incoming webhook'.
url will be of form: https://myapp.slack.com/services/hooks/incoming-webhook?token=mytoken .
(Exact url you should use will appear on the slack integration page)
text will be any valid message.
This implementation could be expanded if you wanted to specify channel, username, etc.
@v-kolesnikov
v-kolesnikov / gist:e667f2fe980ec1b27768776f188b714a
Created April 17, 2016 12:40 — forked from wikimatze/gist:9790374
Github Two-Factor Authentication Failed For HTTPS

I heard from GitHub Two-Factor Authentication](https://github.com/blog/1614-two-factor-authentication) nearly a couple of days ago when I was reading my RSS feed. I enabled it and couldn' push to any of my repositories anymore. Learn in this blog post how to fix it.

Two-Factor Authentication

"Is a process involving two stages to verify the identity of an entity trying to access services in a computer or in a network". Github solves this authentication with sending an SMS to a device which wants to push to their platform.

Enabling Two-Factor Authentication

#%RAML 0.8
title: World Music API
baseUri: http://example.api.com/{version}
version: v1
schemas:
- halLink: |
{ "$schema": "http://json-schema.org/schema",
"type": "object",
"description": "a Hypertext Application Language link",
@v-kolesnikov
v-kolesnikov / env_validation.rb
Created September 18, 2016 10:16 — forked from flash-gordon/env_validation.rb
ENV validation POC
require 'dry-validation'
class EnvValidation
class ENV
def inspect
ivs = instance_variables.each { |v| "#{v}=#{instance_variable_get(v)}" }.join(', ')
"ENV[#{ivs}]"
end
def to_s
@v-kolesnikov
v-kolesnikov / _post.md
Created April 17, 2017 10:23 — forked from klapaucius/_post.md
spine-strict_lists

Строгость и нищета списков.

Map и структурная рекурсия.

Применить функцию к каждому элементу списка - это просто: ###GHC/Base.lhs

map _ []     = []
map f (x:xs) = f x : map f xs