Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"syscall" | |
) | |
func main() { |
extern crate actix_web; | |
use actix_web::{fs, server, App}; | |
fn main() { | |
server::new(|| { | |
App::new() | |
.handler( | |
"/", | |
fs::StaticFiles::new("./public") | |
.unwrap() |
use std::io::prelude::*; | |
use std::net::TcpListener; | |
use std::net::TcpStream; | |
mod app; | |
fn main() { | |
let listener = TcpListener::bind("127.0.0.1:7878").unwrap(); | |
for stream in listener.incoming() { | |
let stream = stream.unwrap(); | |
handle_connection(stream); |
//CommandTimeoutWithContext command timeout with background context | |
func CommandTimeoutWithContext(command string, timeout time.Duration) (string, error) { | |
ctx, cancel := context.WithTimeout(context.Background(), timeout) | |
defer cancel() | |
cmd := exec.CommandContext(ctx, "/bin/bash", "-c", command) | |
out, err := cmd.CombinedOutput() | |
if ctx.Err() == context.DeadlineExceeded { | |
fmt.Println("Command timed out") |
// ROLLUP CONFIG from @makio64 | |
//-------------------------------------------------------------------------- PLUGINS | |
import includePaths from 'rollup-plugin-includepaths' | |
import rootImport from 'rollup-plugin-root-import' | |
import resolve from 'rollup-plugin-node-resolve' | |
import builtins from 'rollup-plugin-node-builtins' | |
import babel from 'rollup-plugin-babel' | |
import commonjs from 'rollup-plugin-commonjs' |
This can be applied generically but usually applies to Linux nodes that have a local caching nameserver running, which means pointing to an IP in the loopback
range (127.0.0.0/8
). Ubuntu 18.04 Bionic Beaver does this by default.
sudo systemctl mask systemd-resolved
rm -f /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
After download and move to your interested folder, add this line to ~/.bashrc and ~/.profile
export GOPATH=$HOME/gowork
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
js_import batch-api-min.js; | |
# keyval_zone for APIs where the last portion of the URI is an argument | |
# The key is the portion of the URL before the last part | |
keyval_zone zone=batch_api:64k state=/etc/nginx/state-files/batch-api.json; | |
keyval $uri_prefix $batch_api zone=batch_api; | |
# keyval_zone for APIs where the last portion of the URI is an argument | |
# The key is the URI | |
keyval_zone zone=batch_api2:64k state=/etc/nginx/state-files/batch-api2.json; |