Skip to content

Instantly share code, notes, and snippets.

View apostololeg's full-sized avatar
🦉
d–_–b

Oleg Apostol apostololeg

🦉
d–_–b
View GitHub Profile
@apostololeg
apostololeg / Code.gs
Last active November 4, 2021 13:46
Gmail remove batch messages
let count = 1500;
const batchSize = 100;
async function purgeGmail(query) {
const items = GmailApp.search("label:github", 0, batchSize);
console.log(count, items.length);
await GmailApp.moveThreadsToTrash(items);
@apostololeg
apostololeg / terminator-config
Last active March 24, 2021 09:46
~/.config/terminator/config
[global_config]
window_state = maximise
suppress_multiple_term_dialog = True
always_split_with_profile = True
[keybindings]
cycle_next = None
cycle_prev = None
next_tab = <Ctrl>Tab
prev_tab = <Ctrl><Shift>Tab
paste = <Ctrl>V
@apostololeg
apostololeg / libinput-gestures.conf
Created January 4, 2021 08:24
~/.config/libinput-gestures.conf
# Generated by Gestures 0.2.3 --> https://gitlab.com/cunidev/gestures
# Manual editing might result in data loss!
# Invalid lines
# Unsupported lines
# Swipe threshold (0-100)
// Thx to: https://gist.github.com/xposedbones/75ebaef3c10060a3ee3b246166caab56#gistcomment-2951694
// map(4, ...[0, 20], ...[.3, 0]) // .24
const map = (value, x1, y1, x2, y2) => (value - x1) * (y2 - x2) / (y1 - x1) + x2;
// Mask('**.**.****', '17.02');
// Mask('+7 (***) ***-**-**', '9854554354123283293');
// Mask('+7 (***) ***-**-**', '9854554354123283293', { isStrict: true });
export function mask(maskStr, str, { isStrict = false } = {}) {
let decorSymbCount = 0;
let maskedStr = '';
for (let i = 0; i < maskStr.length && str[i - decorSymbCount]; i++) {
const m = maskStr[i];
const v = str[i - decorSymbCount];
const METRICS_BY_AXIS = {
horizontal: {
size: 'clientWidth',
scroll: 'scrollWidth'
},
vertical: {
size: 'clientHeigh',
scroll: 'scrollHeigh'
}
};
#!/bin/bash
gpg --version # Check GPG installation
git --version # Check Git installation
git-secret --version # Check git-secret installation
gpg --list-keys # Make sure that your GPG key is listed here
git init # Initialize the repository if you have not done it already
git secret init # Initialize the repository using git-secret
git secret tell email@example.com # Add a user
@apostololeg
apostololeg / Elevator.js
Last active January 22, 2019 11:49
Elevator
const DIRECTION_DOWN = -1;
const DIRECTION_NONE = 0;
const DIRECTION_UP = 1;
function HardwareElevator() {}
HardwareElevator.prototype = {
moveUp: function() { console.log("up") },
moveDown: function() { console.log("down") },
@apostololeg
apostololeg / eslint-changed.sh
Last active July 4, 2018 12:26 — forked from kentcdodds/eslint-changed.sh
Shell script to lint only changed files to be used as a githook (specific to my project)
#!/usr/bin/env bash
set -e
NM_BIN=./node_modules/.bin
echo "Linting changed files"
SRC_FILES=$(git diff --staged --diff-filter=ACMTUXB --name-only -- '*.js' | grep -v '\.test\|mock\|e2e\.js$') && x=1
function lint() {
if [ "$2" ]; then
{
"always_show_minimap_viewport": true,
"auto_indent": true,
"bold_folder_labels": true,
"close_sidebar_if_opened": false,
"color_scheme": "Packages/User/SublimeLinter/Juicy (SL).tmTheme",
"enable_tab_scrolling": false,
"ensure_newline_at_eof_on_save": true,
"font_face": "Menlo",
"font_options":