Skip to content

Instantly share code, notes, and snippets.

@qwelias
qwelias / nginx-docker-certbot-auto-renew-webroot.md
Last active November 18, 2021 22:15
How to auto renew existing certificates with nginx docker container and certbot webroot

How to auto renew existing certificates with nginx docker container and certbot webroot

  1. add following to each server block in nginx config
    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /nginx/path/to/webroot;
    }
    
    this will allow your server to answer on ACME challenge
  2. mount volume /certbot/path/to/webroot to nginx's container on /nginx/path/to/webroot, this will allow other containers to place challenge answers for nginx
@qwelias
qwelias / banner
Created April 19, 2020 15:07
Bannerlord
27.116.2.1746.1714.766.752.1.0.0.202.144.149.285.285.922.574.1.0.70.202.144.149.285.285.611.574.1.1.289.340.144.132.368.368.767.564.0.0.0.316.146.116.468.468.764.854.1.1.0.324.13.116.160.362.845.743.1.1.0.324.13.116.160.362.687.743.1.0.0.515.144.116.61.61.844.965.1.1.0.515.144.116.61.61.684.965.1.1.0.301.144.116.191.191.764.950.1.0.180.104.149.116.161.161.766.750.0.1.0
@qwelias
qwelias / index.html
Last active March 6, 2020 15:03 — forked from mlhaufe/index.html
strict mode efficiency Array#{map,fill,reduce} (http://jsbench.github.io/#88006c73d4d180cade74f99c149bfff6) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>strict mode efficiency Array#{map,fill,reduce}</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
const isRightOf = (v, [a, b]) => v > b;
const isLeftOf = (v, [a, b]) => v < a;
const isIn = (v, r) => !isLeftOf(v, r) && !isRightOf(v, r);
const isOver = (range, r) => isRightOf(range[1], r) && isLeftOf(range[0], r);
class RangeList {
constructor () {
this.list = [];
}
/**
@qwelias
qwelias / npm-force-upgrade.md
Last active December 13, 2018 12:50
Update dependencies ignoring semver

dependencies

npm i $(node -e "console.log(Object.entries(require('./package.json').dependencies).filter(([n,v]) => v.length < 20).map(([n]) => n+'@latest').join(' '))") --save

devDependencies

npm i $(node -e "console.log(Object.entries(require('./package.json').devDependencies).filter(([n,v]) =&gt; v.length &lt; 20).map(([n]) =&gt; n+'@latest').join(' '))") --save-dev

# oh-my-zsh Bureau Theme
### NVM
ZSH_THEME_NVM_PROMPT_PREFIX="%{$fg_bold[green]%}%B⬡%b%{$reset_color%} "
ZSH_THEME_NVM_PROMPT_SUFFIX=""
### Git [master ▾●]
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg_bold[cyan]%}"
var {access_token, refresh_token, id_token} = new URL(location.href).hash.slice(1).split('&').map(s => s.split('=')).reduce((o, [k, v]) => Object.assign(o, {[k]: decodeURIComponent(v)}), {}); [access_token, refresh_token, id_token].join('###')
@qwelias
qwelias / pathFrom.js
Created September 10, 2018 10:55
Ramda. Populate object dst path from src paths and rm all src paths.
const R = require('ramda');
const castArray = v => Array.isArray(v)
? v
: v == null
? v
: [v];
const pathFrom = R.curry((path, sources, obj) => sources.map(castArray).reduce((obj, source) => {
const current = R.path(path, obj);
<!DOCTYPE html>
<html>
<head>
<style media="screen">
html, body {
height: 100%;
width: 100%;
margin: 0;
font-size: 0;
}
'''
In order to use this script, you need to have a file named overrides.txt and rules.py exist in
the same dir that you run mitmproxy.
An example of overrides.txt file might look like:
<urlRegExp> , <filePath> , [cmd]
rules.py should define cmd named functions as cmd(fileText, urlRegExpMatch)
Usage: mitmproxy -s overrides.py