Skip to content

Instantly share code, notes, and snippets.

View 1d10t's full-sized avatar
❄️
winter in russian midland is longer than 1/2 of year

Serg 1d10t

❄️
winter in russian midland is longer than 1/2 of year
View GitHub Profile
@1d10t
1d10t / LetsEncrypt+certbot+UFW+postfix+dovecot.md
Created January 11, 2023 17:59 — forked from mrothNET/LetsEncrypt+certbot+UFW+postfix+dovecot.md
Let's Encrypt / Dovecot / Postfix / UFW firewall / Certbot

Let's Encrypt / Dovecot / Postfix / UFW firewall / Certbot

This tutorial describes how to install TLS to a mail server consisting of Postfix and/or Dovecot by using Let's Encrypt certificates with automatic renewing and firewall management.

The system used for this tutorial was:

$ lsb_release -idrc
Distributor ID: Ubuntu
@1d10t
1d10t / html_audio_balance_stereo.js
Created March 9, 2017 02:57
htmlaudioelement (audio) random stereo balance example
HTMLAudioElement.prototype.balance = function(leftValue, rightValue){
if(!this.leftGain || !this.rightGain){
var audioCtx = new AudioContext();
if(audioCtx.destination.channelCount != 2){
console.log('Destination channel count is not two:', audioCtx.destination.channelCount);
return;
}
var audioSrc = audioCtx.createMediaElementSource(this);
String.prototype.htmldecode = function(){
if(!window.htmldecode_textarea) window.htmldecode_textarea = document.createElement('textarea');
window.htmldecode_textarea.innerHTML = this;
return window.htmldecode_textarea.value;
}
function ubtoa(str){
return window.btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
// Every monday
// https://www.linkedin.com/search/results/content/?authorIndustry=%5B%22104%22%2C%22137%22%5D&facetSortBy=date_posted&keywords=php%20remote&origin=SORT_RESULTS&recency=past-week
[].map.call(document.querySelectorAll('button[data-control-name="commentary_expand"]'), e => e.click())
var textNode, textNodes = document.evaluate( '//div[contains(@class,"feed-shared-text-view")]', document, null, XPathResult.ANY_TYPE, null );
while (textNode = textNodes.iterateNext()) {
let text = textNode.textContent, m = text.match(/\b[a-z\d][a-z\d._-]*@[a-z\d._-]+[a-z\d]\b/i);
if(!m) continue;
var
(_ => {
const scrollable = document.querySelector('c-wiz[data-ogpc]');
setInterval(_ => {
let scrollby = 0;
[].map.call(document.querySelectorAll('div[role="presentation"]'), e => {
scrollby += e.offsetHeight;
const dd = {};
@1d10t
1d10t / insta-follow.js
Last active August 22, 2019 12:15
follow instagam list
const tout = 10*1000;
let skip = 0, lbsc = 0;
setInterval(_ => {
if(skip){ skip--; lbsc = 0; return; }
const bs = [].filter.call(document.querySelectorAll('div[role="dialog"] button'), e => e.innerText=='Follow'), bsc = bs.length;
if(bsc){
if(bsc == lbsc){ skip = Math.round(5*60*1000/tout); return; }
bs[Math.floor(bsc*Math.random())].click();
lbsc = bsc;
}
@1d10t
1d10t / linkedin-mass-contact.js
Last active March 6, 2019 12:46
linkedin-mass-contact.js
// ==UserScript==
// @name установить контакт со всеми
// @namespace http://tampermonkey.net/
// @version 0.1
// @author Sergey S Yaglov
// @match https://www.linkedin.com/search/results/people/*
// @include https://www.linkedin.com/search/results/people/*
// @grant https
// @run-at context-menu
// ==/UserScript==
@1d10t
1d10t / packff.bat
Created November 23, 2018 16:03
pack directory-separated arrays of mp3 pieces to a big mp3s
php -r "foreach(glob('./*/') as $d){ $dn=basename($d); $a=glob($d.'*.mp3'); natsort($a); var_dump($dn, $a); $asize=array_sum(array_map('filesize',$a)); $rf=$dn.'-ffccat.mp3'; $lf=$dn.'.txt'; if(file_exists($rf)&&filesize($rf)>=$asize) continue; foreach($a as $i => $f) file_put_contents($lf, \"file '$f'\n\", $i ? FILE_APPEND : null); passthru('c:/ffmpeg/ffmpeg-20181015-c27c7b4-win64-static/bin/ffmpeg -f concat -safe 0 -i '.escapeshellarg($lf).' -c copy '.escapeshellarg($rf)); }"
@1d10t
1d10t / up_vpn.sh
Last active August 26, 2018 23:08
openwrt vpn up cron script
#!/bin/sh
. /usr/share/libubox/jshn.sh
O=$(ubus -S call network.interface status "{ \"interface\" : \"vpn0\" }")
json_load "$O"
json_get_var up up
if [ "$up" == "0" ]; then
@1d10t
1d10t / vk_m3u.js
Last active March 23, 2018 11:17
vkontakte music m3u generating content script
/*
run in console at https://vk.com/audio
to download from wall, go to https://vk.com/wall[ID]?own=1&offset=[OFFSET]
wait for m3u file
use this autohotkey script https://gist.github.com/1d10t/6f8b151e50905449c63abc851dceb167
to download mp3 files
*/
(function(){