Skip to content

Instantly share code, notes, and snippets.

View rndD's full-sized avatar
🍎

Alexey Kalmakov rndD

🍎
View GitHub Profile
@rndD
rndD / .gitconfig
Last active November 13, 2023 11:40
git config for 2022-2023
[user]
name = Alexey Kalmakov
email = st00nsa@gmail.com
[core]
mergeoptions = --no-ff
pager = less -r
[alias]
vlog = log --pretty='%h (%an) %s' --graph
st = status
co = checkout
// Ее нужно поставить через твою среду разработки, ну или положить рядом с проектом
#include <AccelStepper.h>
#include <AceButton.h>
using namespace ace_button;
// Encoder
boolean TurnDetected;
boolean Up;
// Ее нужно поставить через твою среду разработки
#include <AccelStepper.h>
// Encoder
boolean TurnDetected;
boolean Up;
const int PinCLK = 18;
const int PinDT = 17;
const int PinSW = 16;
version: '2'
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- "5433:5433"
# Redis
redis:
image: redis:2.8.19
hostname: redis
@rndD
rndD / npm
Created July 9, 2016 12:19
Npm inject для кеширования папки node_modules
#!/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
@rndD
rndD / .js
Created April 19, 2016 22:38
findCellsInRadius
const findCellsInRadius = (w, h, center, radius) => {
let cellsInRadius = [];
let [centerX, centerY] = center;
_.range(w).forEach((x) => {
let rangeX = Math.abs(centerX - x);
(rangeX < radius) && _.range(h).forEach((y) => {
let rangeY = Math.abs(centerY - y);
@rndD
rndD / .gitconfig
Last active February 1, 2016 19:28
tmp save my gitconfig
[core]
autocrlf = true
mergeoptions = --no-ff
[user]
email = st00nsa@gmail.com
name = Alex Kalmakov
[help]
autocorrect = 1
[alias]
# Shortcuts
@rndD
rndD / GNUmakefile
Last active December 16, 2015 12:12
gist to show make autovars
dist/libs.js: app/bower_components/lodash/lodash.min.js node_modules/react/dist/react.min.js node_modules/redux/dist/redux.min.js
cat $? > $@
libs: dist/libs.js
.PHONY: libs
@rndD
rndD / shortest_bash_variable.bash
Created March 11, 2015 08:37
print shortest env variable by key (work only in bash, not sh)
for i in `env`; do
key=${i%=*}
[[ -z $short_env ]] && short_env=$key;
[[ ${#key} -lt ${#short_env} ]] && short_env=$key;
done
echo "Shortest env variable: $short_env"
@rndD
rndD / overlap_substrings.py
Created March 3, 2015 17:04
Поиск подстроки внахлест
# -*- coding: utf-8 -*-
import re
def count_substrings_re(string, substring):
substring_re = '(?=(%s))' % re.escape(substring)
return len(re.findall(substring_re, string))
def count_substrings(s, f):
ind = 1
count = 0