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/bash | |
RESP=/tmp/server-response && rm -rf $RESP && mkfifo $RESP | |
while true; do | |
cat $RESP | nc -l 9090 | ( | |
REQ=$(while read -r line && [[ $line != Host* ]]; do echo "$line" ; done) | |
url="${REQ% HTTP/*}" | |
filedata=$(<"$(pwd)${url#* }") | |
cat >$RESP <<EOF | |
HTTP/1.1 $([ -z "${#filedata}" ] && echo '200 OK' || echo '404 NOT FOUND') | |
Content-Length: ${#filedata} |
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
package main | |
import ( | |
"fmt" | |
"strconv" | |
"strings" | |
) | |
func main() { | |
fen := "2r3k1/1q1nbppp/r3p3/3pP3/pPpP4/P1Q2N2/2RN1PPP/2R4K" |
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
// const fen = 'k1K5/8/8/8/8/8/8/1Q6' | |
const fen = '2r3k1/1q1nbppp/r3p3/3pP3/pPpP4/P1Q2N2/2RN1PPP/2R4K' | |
const rows = fen.split('/') | |
const board = [] | |
let i = 0 | |
rows.forEach(row => { | |
const squares = row.split('') | |
board[i] = [] |
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
FROM alpine | |
ENTRYPOINT ["tail", "-f", "/dev/null"] |
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
const jimp = require('jimp') | |
const ASCII = '`^\",:;Il!i~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$' | |
const file = process.argv[2] | |
const invert = process.argv[3] === 'invert' | |
const brightnessAlgo = process.argv[4] | |
jimp.read(file) | |
.then(img => { | |
img = img.resize(160,80) |
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
goaccess /var/log/traefik/access.log --log-format='%h %^[%d:%t %^] "%r" %s %b "%R" "%u" %^ "%v" "%^" %Tms' --date-format=%d/%b/%Y --time-format=%T -o /tmp/report.html --real-time-html | |
{ echo -e "HTTP/1.1 200 OK\r\n\r\n"; cat /tmp/report.html; } | nc -lk 9090 |
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
FROM nginx:alpine | |
COPY default.conf /etc/nginx/conf.d/default.conf | |
RUN mkdir -p /usr/share/nginx/one | |
RUN mkdir -p /usr/share/nginx/two | |
COPY index.html /usr/share/nginx/one/index.html | |
COPY index2.html /usr/share/nginx/two/index.html |
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
function sleep (ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)) | |
} | |
class EventLoop { | |
constructor () { | |
this.timers = [] | |
} |
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
<pre style=line-height:.9;font-family:fantasy> | |
<script> | |
const lineLength = document.querySelector('body').offsetWidth/10 | |
function writeLine() { | |
for(let i = 1; i < lineLength; i++) { | |
document.write(Math.random()<.5?"/":"\\") | |
} | |
} |
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
const webrtc = require('wrtc'); | |
const lzString = require('lz-string'); | |
const readline = require('readline'); | |
const dataChannelSettings = { | |
reliable: { | |
ordered: true, | |
maxRetransmits: 1 | |
} | |
} |
NewerOlder