Skip to content

Instantly share code, notes, and snippets.

View aquilax's full-sized avatar
💭
Fighting entropy

Evgeniy Vasilev aquilax

💭
Fighting entropy
View GitHub Profile
@aquilax
aquilax / index.html
Created May 15, 2021 13:47
Textarea sorting bookmarklet
<a href="javascript:(function(){Array.from(document.querySelectorAll('textarea')).map(function(b){var a=document.createElement('div');var d=document.createElement('button');d.textContent='↑';d.addEventListener('click',function(f){f.preventDefault();b.value=b.value.split('\n').sort().join('\n')});var c=document.createElement('button');c.textContent='↓';c.addEventListener('click',function(f){f.preventDefault();b.value=b.value.split('\n').sort().reverse().join('\n')});a.appendChild(d);a.appendChild(c);b.parentNode.insertBefore(a,b)})})();">Sort textareas</a>
@aquilax
aquilax / bookmarklet_raw.js
Last active May 15, 2021 08:49
Sort lines bookmarklet
javascript:(function(){
var container = document.createElement('div');
container.setAttribute('style', 'position: absolute; top: 0; right: 0; left: 0; bottom: 0; z-index: 9999');
var textarea = document.createElement('textarea');
textarea.setAttribute('style', 'width:99%; height: 20em');
var close = document.createElement('button');
close.textContent = 'Close'
close.addEventListener("click", function() {
#!/bin/bash
set -e
INPUT=$(realpath "$1")
INPUT_PATH=$(dirname "$INPUT")
TMP_DIR=$(mktemp -d -t tar-extract-XXXXX)
SRC_TMP_DIR="$TMP_DIR/in"
DST_TMP_DIR="$TMP_DIR/out"
@aquilax
aquilax / index.html
Last active January 17, 2021 13:25
zadachko
<!DOCTYPE html>
<head>
<style>
.main {
display: flex;
flex-direction: column;
}
#preview {
margin-top: 1em;
white-space: pre;
@aquilax
aquilax / metafilter_playlist.js
Created December 2, 2018 05:23
Copy external links from a thread as tab delimited table
copy(Array.prototype.slice.call(document.querySelectorAll("a"))
.filter(link => link.text && !link.href.startsWith(window.location.href.substr(0, 10)))
.map(link => `${link.href}\t${link.text}`)
.join("\n"));
@aquilax
aquilax / rackspace-dns-to-bind.js
Created August 19, 2018 05:13
Rough Rackspace DNS to bind translator
copy(r.records.reduce((a, row) => {
let line = [
row['name'] + '.',
row['ttl'],
'IN',
row['type'],
'"' + row['data'] + '"',
].join("\t");
a.push(line);
return a;
package main
import (
"reflect"
"sort"
"testing"
)
type item struct {
from int
@aquilax
aquilax / youtube_hide.js
Created October 28, 2017 18:00
This snippet hides all watched videos from the subscriptions list
// This snippet hides all watched videos from the subscriptions list
let nodes = document.querySelectorAll('ytd-thumbnail-overlay-playback-status-renderer');
[].map.call(nodes, (el) => {
el.parentNode.parentNode.parentNode.parentNode.parentNode.setAttribute('hidden', true);
});
0xadC78F169718ED920f1C7d1Cf364D280876Dc715
@aquilax
aquilax / shell.php
Created January 14, 2016 12:13
PrestaShop REPL
<?php
//
// PHP REPL with initialized Prestashop environment
//
// Inspired by https://gist.github.com/Vinai/5579309
//
$configFile = '../config/config.inc.php';