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 conn = await Deno.connect({ hostname: "127.0.0.1", port: 7953 }); | |
| const decoder = new TextDecoder(), | |
| encoder = new TextEncoder(); | |
| const safe = (buffer: Uint8Array) => encoder.encode(decoder.decode(buffer)); | |
| async function pipe(reader: Deno.Reader, writer: Deno.Writer, debug=false) { | |
| const buffer = new Uint8Array(32 * 1024); |
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 net = require('net') | |
| net.createServer(client => { | |
| client.once('data', data => { | |
| client.write(Buffer.from([5, 0])); | |
| client.once('data', data => { | |
| data = [...data]; | |
| let ver = data.shift(); | |
| let cmd = data.shift(); //1: connect, 2: bind, 3: udp | |
| let rsv = data.shift(); |
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
| server { | |
| listen 80; | |
| # maps p8080.example.com -> localhost:8080 | |
| server_name ~^p(?<port>[^.]+)\.example\.com$; | |
| location / { | |
| proxy_pass http://localhost:$port; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; |
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
| #!/usr/bin/env bash | |
| # A command to get the keycodes of your keyboard and configure your ~/.Xmodmap | |
| # I used that for configure my multimedia-keys on XFCE4 @ Manjaro | |
| xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p' | |
| # [e.g.: ~/.Xmodmap | |
| # keycode 162 = XF86AudioPlay | |
| # keycode 164 = XF86AudioStop |
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
| var dgram = require('dgram'); | |
| var host = process.argv[2] || '0.0.0.0'; | |
| var port = process.argv[3] || 514; | |
| var server = dgram.createSocket('udp4'); | |
| server.on('message', function(msg, rinfo) { | |
| console.log("received: %s from %s:%s", msg, rinfo.address, rinfo.port); | |
| }); |
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
| var http = require('http'); | |
| var host = process.argv[2] || '127.0.0.1'; | |
| var port = process.argv[3] || 8080; | |
| http.createServer( function (req, res) { | |
| var proxy = http.request(req.url, function (proxy_res) { | |
| proxy_res.on('data', function (chunk) { |
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
| # Change YOUR_TOKEN to your prerender token | |
| # Change example.com (server_name) to your website url | |
| # Change /path/to/your/root to the correct value | |
| server { | |
| listen 80; | |
| server_name example.com; | |
| root /path/to/your/root; | |
| index index.html; |
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
| axios({ | |
| url: 'http://localhost:5000/static/example.pdf', | |
| method: 'GET', | |
| responseType: 'blob', // important | |
| }).then((response) => { | |
| const url = window.URL.createObjectURL(new Blob([response.data])); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.setAttribute('download', 'file.pdf'); | |
| document.body.appendChild(link); |
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
| var net = require("net"); | |
| process.on("uncaughtException", function(error) { | |
| console.error(error); | |
| }); | |
| if (process.argv.length != 5) { | |
| console.log("usage: %s <localport> <remotehost> <remoteport>", process.argv[1]); | |
| process.exit(); | |
| } |
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 | |
| NAME="hello_app" # Name of the application $DIRNAME | |
| DJANGODIR=/webapps/hello_django/hello # Django project directory #$1 | |
| SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket | |
| USER=hello # the user to run as | |
| GROUP=webapps # the group to run as | |
| NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | |
| DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use | |
| DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name $DIRNAME |