Skip to content

Instantly share code, notes, and snippets.

View bored-engineer's full-sized avatar

Luke Young bored-engineer

View GitHub Profile
@bored-engineer
bored-engineer / _main.go
Last active March 31, 2023 15:07
[Golang] PrefixReader (io.WriteCloser) wraps an io.Reader allowing data to be written ("prefixed") to the Reader which will be returned by subsequent Read calls until Close is called at which points all reads will pass-through to the underlying reader.
// THIS IS THE CORRECT SOLUTION, NOT WHAT WAS IN THIS GIST
package main
import (
"strings"
"io"
"io/ioutil"
"fmt"
)
@bored-engineer
bored-engineer / Run.js
Created September 28, 2011 01:14 — forked from TooTallNate/Run.js
MobileDevice NodObjC basic example.
var $ = require('NodObjC')
$.import('MobileDevice');
$.import('CoreFoundation')
// Callback function that's invoked when a device is plugged in
function callback (i, foo) {
try {
console.log('inside callback!')
var info = new $.am_device_notification_callback_info(i)
#!/usr/bin/ruby
#
# This tool is only used to "decrypt" the github enterprise source code.
#
# Run in the /data directory of the instance.
require "zlib"
KEY = "This obfuscation is intended to discourage GitHub Enterprise customers "+
"from making modifications to the VM. We know this 'encryption' is easily broken. "
@bored-engineer
bored-engineer / exrex.go
Created May 19, 2020 00:30
A go program to expand a regular expression into every possible matching string
package main
import (
"os"
"fmt"
"strings"
"regexp/syntax"
"unicode/utf8"
)
@bored-engineer
bored-engineer / controlmaster_pid.go
Created March 30, 2020 08:37
Get the PID of a SSH controlmaster process
package main
import (
"bytes"
"encoding/binary"
"io"
"log"
"net"
"os"
"time"
@bored-engineer
bored-engineer / mq.go
Created January 29, 2020 20:01
jq but for MessagePack: go build mq.go -o mq
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
@bored-engineer
bored-engineer / watch.go
Created January 17, 2020 23:42
Watch new process spawns from userspace (without becoming root) via polling /proc (`GOOS=linux GOARCH=amd64 go build watch.go`)
package main
import (
"bufio"
"bytes"
"io/ioutil"
"log"
"os"
"path/filepath"
"strconv"
@bored-engineer
bored-engineer / 0_usage.md
Last active February 13, 2019 14:34
A jq script to generate strongly typed golang structures based on results from a GraphQL introspection query

Usage (using get-graphql-schema to fetch the schema):

get-graphql-schema https://hackerone.com/graphql --json | jq -rf graphql.jq

Supports Union types, Enum types, Interfaces, Input Objects and regular Objects.

See bored-engineer/hackeroni-ql for an example library generated with this script.

@bored-engineer
bored-engineer / Tweak.xm
Created December 12, 2011 22:37
Hook webViewDidFinishLoad via theos
#import <UIKit/UIKit.h>
%hook UIWebBrowserView
- (void)webViewDidFinishLoad: (UIWebView *)webView{
//NSLog(@"URL = %@",[webView stringByEvaluatingJavaScriptFromString:@"window.location"]);
%log;
%orig;
}
%end
@bored-engineer
bored-engineer / command.sh
Last active July 23, 2017 12:46
Command to run minio on a WD MyCloud
docker run -d -p 9000:9000 --name $share -v /mnt/HD/HD_a2/$share/:/export -v /mnt/HD/HD_a2/$share/config:/root/.minio minio/minio server /export/data