Skip to content

Instantly share code, notes, and snippets.

Jeremy Apthorp nornagon

Block or report user

Report or block nornagon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nornagon
nornagon / find-deps.js
Last active Dec 20, 2018
List transitive dynamic library dependencies on macOS
View find-deps.js
#!/usr/bin/env node
const child_process = require('child_process')
const printTree = require('print-tree')
const depsOf = (lib) => {
const res = child_process.spawnSync('otool', ['-L', lib])
if (res.status !== 0) {
throw new Error(`Failed to run otool on ${lib}:\n${res.stderr}`)
}
return res.stdout.toString()
@nornagon
nornagon / reverse-ssh.md
Created Dec 18, 2018
SSHing into a machine that can't open listening ports
View reverse-ssh.md

How to get SSH access to a machine that can't open listening ports

This will work on any machine that can freely connect to outside ports, but can't listen for incoming connections.

In particular, Azure DevOps CI agents have no "Rebuild with SSH" option (like CircleCI does), so this technique can be handy for debugging CI issues.

Requirements

  1. You must be able to run arbitrary commands on the remote host, ideally including installing an SSH server.
  2. You need a machine on the internet that's able to open a listening port. I used my Linode. You could use an AWS free tier t2.micro, or open a port to your local machine. Anything works as long as it runs SSH and can receive packets from the target machine. We'll call this machine the 'bounce server'.
@nornagon
nornagon / index.html
Created Dec 4, 2018
Electron Fiddle Gist
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created Nov 28, 2018
Electron Fiddle Gist
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created Nov 28, 2018
Electron Fiddle Gist
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created Nov 9, 2018
Electron Fiddle Gist
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created Oct 16, 2018
Electron Fiddle Gist
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / index.html
Created Oct 16, 2018
Electron Fiddle Gist
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@nornagon
nornagon / what_good_is_a_programmer
Created Aug 22, 2018
What good is a programmer if they can't destroy software?
View what_good_is_a_programmer
#!/bin/sh
tail +3 "$0" | clang -x c -o "$0" - && exec "$0"
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <mach-o/dyld.h>
const char what_good_is_a_writer[] =
"What good is a writer if he can’t destroy literature?\n"
"And us... what good are we if we don’t help as much\n"
@nornagon
nornagon / finite_scroll.txt
Created Jul 2, 2018
Block infinite scroll with uBlock Origin
View finite_scroll.txt
||twitter.com/i/timeline$xhmlhttprequest
You can’t perform that action at this time.