Skip to content

Instantly share code, notes, and snippets.

View vaaas's full-sized avatar
🤔
TFW no js

vas vaaas

🤔
TFW no js
View GitHub Profile
@vaaas
vaaas / ghettowriteroom.el
Created November 29, 2017 16:27
ghetto writeroom in emacs
(defvar-local writing-mode nil)
(defvar-local cached-mode-line nil)
(define-minor-mode writing-mode
"Minor mode for writing"
:variable writing-mode
:init-value nil
:group 'editing-basics
(if (not writing-mode)
(progn
(toggle-frame-fullscreen)
@vaaas
vaaas / win.bat
Created April 24, 2017 18:03
windows setup automation
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install chocolateygui 7zip firefox vlc classic-shell flashplayerplugin bleachbit transmission-qt libreoffice steam paint.net --yes
--- script.gs 2016-12-15 11:35:47.288013274 +0200
+++ new.gs 2016-12-15 11:36:52.824766596 +0200
@@ -216,6 +216,7 @@
text.replaceText('<h4>', '<h4 dir="rtl">');
text.replaceText('<h5>', '<h5 dir="rtl">');
text.replaceText('<h6>', '<h6 dir="rtl">');
+ text.replaceText('<dl>', '<dl dir="rtl">');
}
else if (action == 'removeRtl') {
text.replaceText('<p dir="rtl">', '<p>');
@vaaas
vaaas / ao3miner.js
Last active February 19, 2018 12:27
mine ao3 works listings, output RSS items
(function() {
"use strict"
function map (a, fn) {
var r = []
for (let i = 0; i < a.length; i++) r.push(fn(a[i]))
return r }
const works = document.querySelectorAll("ol.work.index.group > li.own.work")
const data = map(works, el => {
const obj = {}
<!DOCTYPE html>
<!--
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@vaaas
vaaas / markov.py
Created June 28, 2016 22:18
Markov chain based name generator. Takes the name of a text file with names, delimited by spaces as an argument.
import sys
import random
def process (text, length):
for line in text.split("\n"):
if len(line) < length+1: continue
for i in range(len(line) - length):
yield tuple(line[i:i+length+1])
def parse (text, length=2):