Skip to content

Instantly share code, notes, and snippets.

set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
# set window split
bind-key v split-window -h
bind-key b split-window
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
import { VueConstructor } from 'vue'
// Vue plugin for v-html-safe directive (safe alternative to insecure v-html)
const VueSafeHTML = {
install: function (vue: VueConstructor) {
const doc = document.implementation.createHTMLDocument('')
const div = doc.createElement('div')
function sanitizeHTML(htmlString: string) {
div.innerHTML = htmlString
/* eslint max-depth: 0 guard-for-in: 0 */
import { isObject, isFunction, isString } from './utils';
import parseClassExpression from './parse-class-expression';
// eslint-disable-next-line
export default function createElement(_, ...args) {
// for functional component
if (isFunction(_)) {
return createElement.bind(_, {
functional: true,
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@darkxanter
darkxanter / gist:249da77a22f9e0664f01283c3471911d
Created May 5, 2020 19:59
migrate docker volume to another host
docker run --rm -v <SOURCE_DATA_VOLUME_NAME>:/from alpine ash -c "cd /from ; tar -cf - . " | ssh <TARGET_HOST> 'docker run --rm -i -v <TARGET_DATA_VOLUME_NAME>:/to alpine ash -c "cd /to ; tar -xpvf - " '
@darkxanter
darkxanter / uninstall_vmware.sh
Created March 21, 2020 06:46
Completely uninstall VMWare on macOS
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing $entry ["
sudo rm -rf "$entry"
if [[ ! -e "$entry" ]]; then
echo -ne "OK"
@darkxanter
darkxanter / block_exit_nodejs.ts
Created January 8, 2020 08:07
Node js block script exit
process.stdin.resume(); //so the program will not close instantly
const exitHandler = (options: { cleanup?: boolean; exit?: boolean }) => (exitCode?: any) => {
if (options.cleanup) console.log('clean');
if (exitCode || exitCode === 0) console.log(exitCode);
if (options.exit) process.exit();
};
//do something when app is closing
process.on('exit', exitHandler({ cleanup: true }));
['SIGINT', 'SIGTERM', 'SIGUSR1', 'SIGUSR2', 'uncaughtException']
.forEach((it: any) => process.on(it, exitHandler({ exit: true })));
@darkxanter
darkxanter / el_to_dnsmasq.sh
Created August 12, 2019 17:44 — forked from screeny05/el_to_dnsmasq.sh
Easylist to Dnsmasq
wget -q -nv https://easylist-downloads.adblockplus.org/easylist.txt -O list
egrep '^\|\|([a-Z\.]+)\^$' list | cut -d '^' -f1 | sed 's#||#address=/# ; s#$#/127.0.0.1#' | sort | uniq > list.dnsmasq
rm list
#!/bin/sh
easylist() {
echo -n 'Getting EasyList list ... '
out=/etc/dnsmasq.d/easylist.conf
tmp=$(mktemp)
wget -q -nv https://easylist-downloads.adblockplus.org/easylist.txt -O $tmp
egrep '^\|\|([a-Z\.]+)\^$' $tmp | cut -d '^' -f1 | sed 's#||#address=/# ; s#$#/127.0.0.1#' | sort | uniq >$tmp.$$
[ $? -eq 0 ] && sudo mv -f $tmp.$$ $out && wc -l $out || echo -42
rm $tmp