Skip to content

Instantly share code, notes, and snippets.

View psqq's full-sized avatar
🙃
Where is my mind?

Sergey Pestov psqq

🙃
Where is my mind?
View GitHub Profile
"use strict";
let _ = require("underscore");
let g = {};
function createArray (name, n, callback) {
let res = [];
for (let i=0; i<n; i++) {
res[i] = callback(i, res);
"use strict";
var program = `d m 100 100 u m 100 0 d m 200 100`;
var x = 0, y = 0, raised = true;
var words = program.match(/\w+/g);
for (var i = 0; i < words.length; i++) {
if (words[i].toUpperCase() == 'D') raised = false;
if (words[i].toUpperCase() == 'U') raised = true;
if (words[i].toUpperCase() == 'M') {
"use strict";
(function () {
var _inputData = `6 6 4`;
var _lastInputLineIndex = -1;
function readline () { return _inputData.split("\n")[++_lastInputLineIndex]; }
function write (str) { document.body.innerHTML += str.replace(/\n/g, "<br>"); }
function print (str) { write(str + "\n"); }
------------------------------------------------------------
2.​ Функции, закономерности и принципы педагогического
процесса.
http://i-educator.ru/vopros18
существенные, устойчивые связи в развитии и
формировании личности, реализация которых
позволяет добиваться высоких результатов в ее воспитании
и обучении:
- Воспитание личности происходит только в процессе включения
#include <iostream>
#include <limits>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
typedef vector<int> vi;
loadkeys ru
setfont cyr-sun16
/usr/share/kbd/consolefonts/
vim /etc/locale.gen
http://eax.me/vim-commands/
locale-gen
export LANG=ru_RU.UTF-8
lsblk | grep -v "rom\|loop\|airoot"
cfdisk
mkfs.ext2 -L boot /dev/sda1
@psqq
psqq / lambda.js
Last active December 15, 2019 20:09
// LAMBDA WORLD ================================================================
zero = p => x => x;
one = p => x => p(x);
inc = n => p => x => p(n(p)(x));
two = inc(one);
three = inc(two);
add = n => m => m(inc)(n);
five = add(two)(three);
mul = n => m => m(add(n))(zero);
from fractions import Fraction
a = [[1, 5, 1, 0, 0],
[3, 2, 0, 1, 0],
[2, 4, 0, 0, 1]]
b = [10, 12, 10]
c = [2, 3, 0, 0, 0]
@psqq
psqq / watch-for-files.sh
Created December 30, 2015 09:03 — forked from duese/watch-for-files.sh
Looks for file changes in the current directory
#!/bin/bash
inotifywait -m $PWD -r -e create -e moved_to -e delete |
while read path action file; do
TITLE="Filesystem changed"
MESSAGE="The file '$file' appeared in directory '$path' via '$action'"
echo ${MESSAGE}
notify-send "${TITLE}" "${MESSAGE}"
done
-- http://www.tutorialspoint.com/compile_haskell_online.php
import Data.Tree
import Data.List
encodeTree :: Tree t -> String
encodeTree (Node root []) = "01"
encodeTree (Node root childs) = "0" ++ intercalate "" encodeChilds ++ "1"
where encodeChilds = sort $ map encodeTree childs