Skip to content

Instantly share code, notes, and snippets.

View deliseev's full-sized avatar
🏠
Working from home

Denis Eliseev deliseev

🏠
Working from home
View GitHub Profile
@deliseev
deliseev / permute.ts
Created February 15, 2019 05:47
Combinations (Computer Algorithms)
/**
* Heap's method
* https://stackoverflow.com/questions/9960908/permutations-in-javascript/37580979#37580979
* @param permutation - array of numbers for permutation
*/
function* permute(permutation: number[]): IterableIterator<number[]> {
const length = permutation.length;
let result = [...permutation];
let i = 1;
let c = new Array<number>(length).fill(0);
@deliseev
deliseev / download.js
Last active February 8, 2019 06:25
КЛАДР
// Download archive .dbf files
const Fs = require('fs');
const Path = require('path');
const Axios = require('axios');
async function download() {
const url = 'https://www.gnivc.ru/html/gnivcsoft/KLADR/Base.7z';
const path = Path.resolve(__dirname, 'data', 'base.7z');
if (Fs.existsSync(path)) {
@deliseev
deliseev / launch.json
Created December 26, 2018 13:10
VSCode
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
word = input('Enter a word:')
fp = open('/Users/deliseev/Downloads/litf-win.txt', 'r', encoding='cp1251')
words = (w.split()[0] for w in fp.readlines())
nw = ''.join(sorted(word.upper()))
print(nw)
print([w for w in words if nw == ''.join(sorted(w.upper()))])
@deliseev
deliseev / README.md
Last active September 10, 2018 18:51
SQLite JOINS

SQLite3 JOINS

INNER JOIN (L=R)

SELECT Authors.*, Books.*
FROM Authors INNER JOIN Books USING (ID);

INNER JOIN

# | ID | AuthorName | ID | BookName

curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore > .gitignore
curl https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore >> .gitignore
echo "db.sqlite3" >> .gitignore