Skip to content

Instantly share code, notes, and snippets.

View alexey-sh's full-sized avatar
❤️

Aleksey Shaposhnikov alexey-sh

❤️
  • Russia, Saint Petersburg
View GitHub Profile
@alexey-sh
alexey-sh / README.MD
Last active December 31, 2023 16:14
Simple monitoring

To avoid permission error of loki container:

chown -R 10001:10001 /var/lib/docker/volumes/monitoring_loki_data_rules/*
chown -R 10001:10001 /var/lib/docker/volumes/monitoring_loki_data_chunks/*
@alexey-sh
alexey-sh / local-config.yaml
Created November 11, 2023 14:04
Pino, docker, promtail, loki and grafana
auth_enabled: false
target: all
http_prefix: ""
ballast_bytes: 0
use_buffered_logger: true
use_sync_logger: true
common:
path_prefix: /loki
@alexey-sh
alexey-sh / pikabu-quick-ban.js
Created May 13, 2023 14:48
Кнопка для быстрого бана автора поста на пикабу
function getXCsrfToken() {
const data = JSON.parse(document.querySelector('[data-entry="initParams"]').innerText);
return data.csrfToken;
}
function banRequest(userId, xCsrfToken) {
const data = `authors=${userId}&communities=&tags=&keywords=&period=forever&action=add_rule`;
const url = 'https://pikabu.ru/ajax/ignore_actions.php';
@alexey-sh
alexey-sh / sign.js
Created August 14, 2019 21:51 — forked from nolim1t/sign.js
node.js HMAC SHA512 signing
var crypto = require("crypto");
function encrypt(key, str) {
var hmac = crypto.createHmac("sha512", key);
var signed = hmac.update(new Buffer(str, 'utf-8')).digest("base64");
return signed
}

Keybase proof

I hereby claim:

  • I am alexey-sh on github.
  • I am alexey_sh (https://keybase.io/alexey_sh) on keybase.
  • I have a public key whose fingerprint is A7C9 B125 F774 C05B 84B6 673F 67F0 9AA8 B464 8F00

To claim this, I am signing this object:

@alexey-sh
alexey-sh / main.css
Last active April 28, 2017 19:25
style vk audio page
.ui_tabs_box .ui_tab, .ui_tabs_box .ui_tab_sel, .ui_tabs_header .ui_tab, .ui_tabs_header .ui_tab_plain, .ui_tabs_header .ui_tab_sel, .ui_tabs_sub_header .ui_tab, .ui_tabs_sub_header .ui_tab_plain, .ui_tabs_sub_header .ui_tab_sel {
padding: 12px 3px 12px!important;
line-height: 14px!important;
height: 22px!important;
}
.ui_tabs_box .ui_tab:hover, .ui_tabs_box .ui_tab_sel, .ui_tabs_header .ui_tab:hover, .ui_tabs_header .ui_tab_sel, .ui_tabs_sub_header .ui_tab:hover, .ui_tabs_sub_header .ui_tab_sel {
padding-bottom: 0!important;
}
.audio_page_layout .audio_page__main_tabs_btn {
margin: 0!important;
@alexey-sh
alexey-sh / main.js
Created March 5, 2017 15:14
harlem shake maker
javascript:(function(){function c(){var e=document.createElement("link");e.setAttribute("type","text/css");e.setAttribute("rel","stylesheet");e.setAttribute("href",f);e.setAttribute("class",l);document.body.appendChild(e)}function h(){var e=document.getElementsByClassName(l);for(var t=0;t<e.length;t++){document.body.removeChild(e[t])}}function p(){var e=document.createElement("div");e.setAttribute("class",a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s=d(i);return s.height>e&&s.height<n&&s.width>t&&s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=document.documentElement;if(!!window.innerWidth){return window.innerHeight}else if(e&&!isNaN(e.clientHeight)){return e.clientHeight}return 0}function y(){if(window.pageYOffset){return window.pageYOffset}return Math.max(document.documentElement.scrollTop,document.body.scrollTop)}funct
@alexey-sh
alexey-sh / drom.js
Created October 27, 2016 14:13
Find median price on drom ru
function median (values) {
values.sort(function (a, b) {
return a - b;
});
var half = Math.floor(values.length / 2);
if (values.length % 2)
return values[half];
else
return (values[half - 1] + values[half]) / 2.0;
}
@alexey-sh
alexey-sh / mixins.scss
Created September 12, 2016 16:00
custom toast
@mixin box-shadow($value) {
-webkit-box-shadow: $value;
-moz-box-shadow: $value;
box-shadow: $value;
}
@alexey-sh
alexey-sh / main.js
Created March 3, 2016 09:18
alfabank currencies
function loadScript () {
return $.getScript('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js');
}
function loadData () {
return $.getJSON('https://alfabank.ru/ext-json/0.2/exchange/cash/?offset=0&limit=20').then(function (d) { return d.response.data.usd.filter(function (x) {return x.type==='buy'}); });
}
function drawChart () {
$.when(loadData(), loadScript()).then(function (currencies) {