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 { serve, serveTls } from "https://deno.land/std@0.177.0/http/server.ts"; | |
const TARGET = Deno.env.get("TARGET"); | |
const PORT = Deno.env.has("PORT") ? Number(Deno.env.get("PORT")) : undefined; | |
const CERT_FILE = Deno.env.get("CERT_FILE"); | |
const KEY_FILE = Deno.env.get("KEY_FILE"); | |
if (!TARGET) { | |
console.log("Usage:", "TARGET=http://upstream:1234/ [CERT_FILE=/path/to/cert KEY_FILE=/path/key] deno run --allow-env --allow-net proxy.ts") |
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
delete from agency; | |
delete from stops; | |
delete from routes; | |
delete from calendar; | |
delete from calendar_dates; | |
delete from trips; | |
delete from stop_times; | |
vacuum; | |
.mode csv | |
.import static/agency.txt agency --skip 1 |
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 updateButtons(node, shift) { | |
[...node.querySelectorAll("button")].forEach(button => { | |
let value = button.dataset.value; | |
switch (value) { | |
case "backspace": button.textContent = "←"; break; | |
case "shift": button.textContent = "↑"; break; | |
case " ": button.textContent = "(space)"; break; | |
default: button.dataset.value = button.textContent = (shift ? value.toUpperCase() : value.toLowerCase()); break; | |
} |
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
/* tiny glue to brige v8cgi/teajs-based apps with a node websocket module */ | |
var WebSocketServer = require('websocket').server; | |
var HTTP = require('http'); | |
var HTTPS = require('https'); | |
var fs = require('fs'); | |
var Server = function(ip, port, options) { | |
this.setDebug(true); | |
this._options = { |
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 | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the branch/status of the current Git or Mercurial repository | |
# * the return value of the previous command | |
# | |
# USAGE: | |
# |
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 | |
# usage: ./gmake.sh [makefile_target] | dot -Tpng > Makefile.png | |
echo "digraph G {" | |
make -Bnp $* \ | |
| grep ": " \ | |
| grep -v "\(^\.\|[#%]\)" \ | |
| sed -e "s/ *|.*//" \ | |
| awk '{split($$0,a ,"[: ]+"); for(i=2;i<=length(a);i++) print "\""a[i]"\"->\""a[1]"\""}' |
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 { serve, ServerRequest } from "https://deno.land/std@master/http/server.ts"; | |
const body = "<img src=https://deno.land/images/deno_logo.png>"; | |
const port = Deno.args[0] || "8888"; | |
function processRequest(req: ServerRequest) { | |
req.respond({body}); | |
} | |
for await (const req of serve(`:${port}`)) { |
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
var DATA = [0.00054931640625,0.03980870544910431,0.07900670915842056,0.11808288842439651,0.15697699785232544,0.1956290602684021,0.2339794784784317,0.2719690799713135,0.3095393776893616,0.3466323912143707,0.38319090008735657,0.41915857791900635,0.4544799327850342,0.48910051584243774,0.5229669213294983,0.5560269951820374,0.5882296562194824,0.6195253729820251,0.6498658061027527,0.6792041659355164,0.7074952125549316,0.7346954345703125,0.7607627511024475,0.7856570482254028,0.8093398809432983,0.8317748308181763,0.8529272079467773,0.8727644085884094,0.8912559151649475,0.9083731770515442,0.9240897297859192,0.9383814334869385,0.9512262344360352,0.962604284286499,0.9724981188774109,0.9808923602104187,0.9877741932868958,0.9931329488754272,0.9969603419303894,0.9992504715919495,0.9999998211860657,0.9992073178291321,0.9968740344047546,0.9930036664009094,0.987602174282074,0.9806778430938721,0.9722414016723633,0.9623057842254639,0.9508864283561707,0.9380008578300476,0.9236689209938049,0.9079127907752991,0.8907567262649536,0. |
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
~/node_modules/.bin/tsc --allowJs --checkJs --noEmit --baseUrl `pwd` --lib dom,es6 |
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 node | |
var WebSocketServer = require('websocket').server; | |
var http = require('http'); | |
var port = process.env.PORT || 8080; | |
var server = http.createServer(function(request, response) { | |
console.log((new Date()) + ' Received request for ' + request.url); | |
response.writeHead(404); | |
response.end(); | |
}); |
NewerOlder