For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
var util = require('util') | |
function hook_stdout(callback) { | |
var old_write = process.stdout.write | |
process.stdout.write = (function(write) { | |
return function(string, encoding, fd) { | |
write.apply(process.stdout, arguments) | |
callback(string, encoding, fd) | |
} |
// $ 6g echo.go && 6l -o echo echo.6 | |
// $ ./echo | |
// | |
// ~ in another terminal ~ | |
// | |
// $ nc localhost 3540 | |
package main | |
import ( |
// LZW-compress a string | |
function lzw_encode(s) { | |
var dict = {}; | |
var data = (s + "").split(""); | |
var out = []; | |
var currChar; | |
var phrase = data[0]; | |
var code = 256; | |
for (var i=1; i<data.length; i++) { | |
currChar=data[i]; |
// This is what I think I have to do now: | |
cluster(http.createServer(requestCallback)).listen(80); | |
cluster(https.createServer(credentials, requestCallback)).listen(443); | |
// The above creates 2 clusters (2 x NumProcessors processes). What I'd like to do is have every | |
// process do a listenFD on the two ports, so in Cluster, maybe express it something like: | |
cluster([ | |
http.createServer(requestCallback), | |
https.createServer(credentials, requestCallback) | |
]).listen([ |
#!/usr/bin/env php | |
<?php | |
$app = function($request) { | |
$body = <<<EOS | |
<!DOCTYPE html> | |
<html> | |
<meta charset=utf-8> | |
<title>Hello World!</title> |
<?php | |
file_put_contents( 'progress.txt', '' ); | |
$targetFile = fopen( 'testfile.iso', 'w' ); | |
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' ); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt( $ch, CURLOPT_NOPROGRESS, false ); | |
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' ); | |
curl_setopt( $ch, CURLOPT_FILE, $targetFile ); |
#!/bin/sh | |
# A script to enable laptop power saving features for #! & Debian GNU+linux. | |
# http://crunchbanglinux.org/forums/topic/11954 | |
# List of modules to unload, space seperated. Edit depending on your hardware and preferences. | |
modlist="nsc_ircc uhci_hcd" | |
# Bus list for runtime pm. Probably shouldn't touch this. | |
buslist="pci i2c" | |
case "$1" in |
package main | |
import bufio "bufio" | |
import fmt "fmt" | |
import os "os" | |
func main() { | |
var state = "0" | |
var cache = " " | |