Skip to content

Instantly share code, notes, and snippets.

View sskoopa's full-sized avatar

SS Koopa sskoopa

View GitHub Profile
@sskoopa
sskoopa / react-to-preact-codemod.js
Last active February 9, 2022 11:54
react -> preact codemod
// use via
// jscodeshift -t all.js src
//
const sourceOptions = { quote: 'single' }
/**
* Removes the named import: PropTypes
*/
const removeNamedImportPropTypes = (file, api) => {
const j = api.jscodeshift
@thisconnect
thisconnect / app.js
Last active July 14, 2020 06:40
rollup split lib and app
import * as Lib from 'lib';
console.log('APP');
console.log(Lib);
console.log(Lib.capitalize('hello world'));
@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