Skip to content

Instantly share code, notes, and snippets.

View DavyLandman's full-sized avatar

Davy Landman DavyLandman

View GitHub Profile
@DavyLandman
DavyLandman / ssh-ssl-in-one.js
Last active July 20, 2017 09:41
A recent nodejs trick, hide the ssh agent behind a https port. This means you can serve stuff via https, and almost always login into ssh (since the 443 port is hardly filtered/proxied).And if you have ssh, well all bets are off ;-)
var net = require('net');
net.createServer(httpsSshSwitch).listen(443);
// if the first byte is 22, it is a https handshake,
// so redirect it to the actual https server (running on port 8443)
// else redirect it to the ssh instance.
//
// some ssh clients wait for the server to send the first welcome message
// so if we have not seen any data for 2 seconds, assume it is a ssh connection
@DavyLandman
DavyLandman / ssh-ssl-in-one.go
Last active January 31, 2016 14:13
The ssh-ssl-behind same port trick but now in go (previous version was in nodejs https://gist.github.com/DavyLandman/8314380 ) for more details on how it works, see the other issue. *why go?:* nodejs is not that nice for low-performance cpu's, and go nicely compiles to a native application :)
package main
import (
"net"
"log"
"time"
)
var noDeadline = time.Time{}
@DavyLandman
DavyLandman / gist:c0dd99cdbee35d1a9a4e
Last active August 29, 2015 14:07
Rename pdf's based on metadata (requires pdfinfo from the poppler package)
# It uses the pdf meta data to rename the file to the title of the pdf
# on osx it requires poppler installed: brew install poppler
find . -type f -name "*.pdf" -exec sh -c 'mv "$0" "$(pdfinfo $0 | sed -n "/^Title/ s/Title:\(.*\)/\1.pdf/p" | sed "s/^[ \t]*//" | sed -e "s/[^A-Za-z0-9._-]/_/g")"' {} \;
@DavyLandman
DavyLandman / keybase.md
Created February 25, 2015 08:35
keybase.md

Keybase proof

I hereby claim:

  • I am DavyLandman on github.
  • I am davylandman (https://keybase.io/davylandman) on keybase.
  • I have a public key whose fingerprint is 49D1 473B AAB8 8188 A2BA 8705 D40E 418E 10BE 143C

To claim this, I am signing this object:

@DavyLandman
DavyLandman / panic-20150414-215721.log
Created April 19, 2015 14:29
syncthing-panic-logs
[O67KX] 2015/04/14 21:56:53.779665 main.go:398: INFO: syncthing v0.10.30 (go1.4.2 linux-arm default) builduser@leming 2015-03-29 07:46:44 UTC
[O67KX] 2015/04/14 21:56:53.780569 main.go:399: INFO: My ID: ---
[O67KX] 2015/04/14 21:56:54.612056 progressemitter.go:90: DEBUG: progress emitter: updated interval 5s
[O67KX] 2015/04/14 21:56:54.613151 progressemitter.go:57: DEBUG: progress emitter: timer - looking after 0
[O67KX] 2015/04/14 21:56:54.613415 progressemitter.go:73: DEBUG: progress emitter: nothing new
[O67KX] 2015/04/14 21:57:08.220194 main.go:665: INFO: Starting web GUI on http://0.0.0.0:8384/
[O67KX] 2015/04/14 21:57:14.601994 model.go:414: DEBUG: IDX(in): --- "Davy-Documents": 0 files
[O67KX] 2015/04/14 21:57:14.612013 model.go:414: DEBUG: IDX(in): --- "Davy-Pictures": 0 files
[O67KX] 2015/04/14 21:57:14.627633 model.go:414: DEBUG: IDX(in): --- "davy-camera": 0 files
[O67KX] 2015/04/14 21:57:14.637224 main.go:916: INFO: Starting local discovery announcements