This file contains hidden or 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
package main | |
import ( | |
"crypto/tls" | |
"net/http" | |
"golang.org/x/crypto/acme/autocert" | |
) | |
func main() { |
This file contains hidden or 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
ssh -f <server> -L <port on source machine>:<ip/address on target network>:<port on target network> -N | |
Example: | |
ssh -f home -L 8001:10.0.0.1:80 -N |
This file contains hidden or 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
(function () { | |
var WL = window.WL; | |
var WB = wunderbits.core; | |
var WBDeferred = WB.WBDeferred; | |
var when = WB.lib.when; | |
WL.apiActions = { | |
'init': function (sdkInstance) { |
This file contains hidden or 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
function isOrgNumberValid(orgNumber) { | |
if (orgNumber.toString().length != 9) { | |
return false; | |
} | |
const wheightNumbers = [3, 2, 7, 6, 5, 4, 3, 2]; | |
const orgNumbers = orgNumber.toString().split(''); | |
const controlDigit = orgNumbers[orgNumbers.length - 1] | |
const result = wheightNumbers.map((n, i) => n * orgNumbers[i]).reduce((a, b) => a+b, 0) | |
const rest = result % 11; | |
return +controlDigit === rest; |
This file contains hidden or 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
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"time" | |
"github.com/goburrow/serial" | |
) |
This file contains hidden or 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
auto lo | |
iface lo inet loopback | |
# Uncomment this to use DHCP | |
# auto eth0 | |
# iface eth0 inet dhcp | |
auto eth0 | |
iface eth0 inet static | |
address 10.0.0.5 |
This file contains hidden or 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/bash | |
tar czf - brain.new brain.service | ssh smart 'tar xzf - -C /srv/brain/ && ( mv /srv/brain/brain{,.old} ; mv /srv/brain/brain{.new,} ) && systemctl daemon-reload && service brain restart' |
This file contains hidden or 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/bash | |
tar czf - brain.new brain.service | ssh smart 'tar xzf - -C /srv/brain/ && ( mv /srv/brain/brain{,.old} ; mv /srv/brain/brain{.new,} ) && systemctl daemon-reload && service brain restart' |
This file contains hidden or 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
const flattenArray = (x, y) => (x || []).concat(y); | |
// Usage: | |
[[1,2],[3],[4]].reduce(flattenArray); | |
// Or: | |
[[1,2],[3],[4]].reduce((x, y) => (x || []).concat(y)); |
This file contains hidden or 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
<html> | |
<head></head> | |
<body> | |
<section id="app"> | |
<p>{{message}}</p> | |
<input v-model="message"> | |
</section> | |
<script src="https://unpkg.com/vue"></script> | |
<script> | |
new Vue({ |