Skip to content

Instantly share code, notes, and snippets.

View Aleksandr-ru's full-sized avatar
🚀
To infinity... and beyond

Aleksandr.ru Aleksandr-ru

🚀
To infinity... and beyond
View GitHub Profile
@Aleksandr-ru
Aleksandr-ru / Configuration.h
Last active March 16, 2024 11:12
Marlin 2.1.2.1 for Anet ET4 Pro V6 Titan Aero config
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@Aleksandr-ru
Aleksandr-ru / Configuration.h
Last active July 17, 2023 19:14
Marlin 2.1.2.1 for Anet ET4 Pro Z-stop config
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@Aleksandr-ru
Aleksandr-ru / memory_limit.php
Last active January 11, 2022 16:24
Get PHP memory limit in bytes
<?php
function getMemoryLimitBytes()
{
$limit = ini_get('memory_limit');
if ($limit == -1) return 0;
$units = [1 => 'K', 'M', 'G'];
$unit = strtoupper(substr($limit, -1));
if ($exp = array_search($unit, $units)) {
@Aleksandr-ru
Aleksandr-ru / trello-sum-list-cf.js
Last active July 7, 2020 14:53
Сумма кастомных полей указанного столбца в Trello
// на открытой доске выполнить в консоли
(function () {
const bid = window.location.pathname.split('/')[2];
const listName = prompt('Enter list name');
const fetchJson = url => new Promise(resolve => setTimeout(resolve, Math.random() * 300))
.then(() => fetch(url))
.then(response => response.json());
const loading = title => {
let i = 0;
return setInterval(() => console.clear() || console.log(title, ['|', '/', '-', '\\'][(i++ % 4)]), 300);
@Aleksandr-ru
Aleksandr-ru / windows-spotlight-wp.sh
Last active April 20, 2021 06:00
Windows spotlight wallpaper changer for Linux (Elementary OS) and macOS
#!/usr/bin/env bash
# Elementary OS specific:
# 1) edit file "/etc/lightdm/io.elementary.greeter.conf"
# uncomment line 3 "#default-wallpaper=/usr/share/backgrounds/elementaryos-default"
# 2) change symbolic link "/usr/share/backgrounds/elementaryos-default" to "~/windows-spotlight-wp/last.jpg"
function checkret
{
if [ $1 -ne 0 ]; then
@Aleksandr-ru
Aleksandr-ru / cpro-gen-certs.sh
Created November 12, 2019 11:51
Создание 1000 тестовых сертификатов в КриптоПро без браузера
for i in {1..1000}; do
/opt/cprocsp/bin/amd64/cryptcp -creatcert \
-dn "C=RU,L=Moscow,O=Test inc.,CN=ООО Тест $i,E=test@test.com,INN=$(bash random_inn.sh)" \
-pin '' \
-ca http://testgost2012.cryptopro.ru/certsrv \
-provtype 80 \
-nokeygen \
-cont '\\.\HDIMAGE\testcont100'
done
@Aleksandr-ru
Aleksandr-ru / trello-card-description-history.js
Last active February 3, 2022 10:23
Просмотр истории и diff карточки в Trello
// в открытой карточке выполнить в консоли
(function () {
const id = window.location.pathname.match(/\/c\/([^/]+)/)?.pop();
const script = document.createElement('script');
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/jsdiff/4.0.1/diff.js';
document.head.appendChild(script);
script.onload = function () {
fetch(`https://trello.com/1/cards/${id}/actions?filter=updateCard:desc`).then(response => response.json()).then(_history => {
console.clear();
@Aleksandr-ru
Aleksandr-ru / chek-inn-snils-ogrn.js
Last active November 26, 2021 22:18
Проверка контрольной суммы ИНН, СНИЛС, ОГРН, ОГРНИП
// проверка ИНН
function isInnValid(inn){
inn = String(inn).replace(/[^0-9]+/g, '').split('');
if ( inn.length == 10 ) {
return inn[9] == String(((
2*inn[0] + 4*inn[1] + 10*inn[2] +
3*inn[3] + 5*inn[4] + 9*inn[5] +
4*inn[6] + 6*inn[7] + 8*inn[8]
) % 11) % 10);
}
@Aleksandr-ru
Aleksandr-ru / fake_sendmail.sh
Last active September 8, 2017 16:26
Fake Sendmail
#!/bin/sh
DIR="/tmp/fake_sendmail"
EXT=".eml"
[ ! -d $DIR ] && mkdir $DIR && chmod 0777 $DIR
NAME=`date +%s.%N`
FILE="$DIR/$NAME$EXT"
@Aleksandr-ru
Aleksandr-ru / DateTimeRu.php
Created January 24, 2017 13:49
Русскоязычный DateTime с дополнениями
<?php
/**
* Русскоязычный DateTime с дополнениями
*
* @author Aleksandr <aleksandr@aleksandr.ru>
* @link http://www.aleksandr.ru author's website
*/
class DateTimeRu extends DateTime
{
protected static $FN = array(1=>"Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь");