This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 - " ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |