Skip to content

Instantly share code, notes, and snippets.

View grant-h's full-sized avatar

Grant Hernandez grant-h

View GitHub Profile
@grant-h
grant-h / gcc-static.min.sh
Created May 22, 2015 04:57
Statically linking .o files with gcc
#!/bin/sh
set -e
cat > libtest.c <<EOF
#include <stdio.h>
void test_function(int arg)
{
printf("Calling test_function(%d)\n", arg);
@grant-h
grant-h / keybase.md
Created September 15, 2015 16:04
keybase verification

Keybase proof

I hereby claim:

  • I am grant-h on github.
  • I am ghh (https://keybase.io/ghh) on keybase.
  • I have a public key whose fingerprint is B16E AC0A 1120 ED87 4B27 2DF7 E755 22DB D573 AC3B

To claim this, I am signing this object:

@grant-h
grant-h / gist:761d753011b8df8ec417
Created March 5, 2015 15:38
Git Aliases (git sl)
[alias]
br = branch
co = checkout
ci = commit
di = diff
st = status
sl = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all --since='90 days ago'
summary = show # Mercurial crib
@grant-h
grant-h / elf.bin
Created June 8, 2016 15:59
Angr ClaripyZ3Error
f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAAIBHBAAAAABAAAAAAAAAAHChBwAAAAAAAAAAAEAAOAAKAEAAHAAbAAYAAAAFAAAAQAAAAAAAAABAAEAAAAAAAEAAQAAAAAAAMAIAAAAAAAAwAgAAAAAAAAgAAAAAAAAAAwAAAAQAAABwAgAAAAAAAHACQAAAAAAAcAJAAAAAAAAcAAAAAAAAABwAAAAAAAAAAQAAAAAAAAABAAAABQAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAIAGAAAAAAAAgAYAAAAAAAAAACAAAAAAAAEAAAAFAAAAAIAHAAAAAAAAgEcEAAAAAACARwQAAAAA5BEAAAAAAADkEQAAAAAAAAAAIAAAAAAAAQAAAAYAAAAongcAAAAAACieZwQAAAAAKJ5nBAAAAAAwAgAAAAAAAOAZAAAAAAAAAAAgAAAAAAACAAAABgAAAFCeBwAAAAAAUJ5nBAAAAABQnmcEAAAAAJABAAAAAAAAkAEAAAAAAAAIAAAAAAAAAAQAAAAEAAAAjAIAAAAAAACMAkAAAAAAAIwCQAAAAAAARAAAAAAAAABEAAAAAAAAAAQAAAAAAAAAUOV0ZAQAAABIjQcAAAAAAEiNRwQAAAAASI1HBAAAAADsAAAAAAAAAOwAAAAAAAAABAAAAAAAAABR5XRkBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAFLldGQEAAAAKJ4HAAAAAAAonmcEAAAAACieZwQAAAAA2AEAAAAAAADYAQAAAAAAAAEAAAAAAAAAL2xpYjY0L2xkLWxpbnV4LXg4Ni02NC5zby4yAAQAAAAQAAAAAQAAAEdOVQAAAAAAAgAAAAYAAAAYAAAABAAAABQAAAADAAAAR05VAJLQUShroPFyPtJjaoJDxA3weOm3AQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Keybase proof

I hereby claim:

  • I am grant-h on github.
  • I am ghh (https://keybase.io/ghh) on keybase.
  • I have a public key ASCSvvt-Xx5MQV1FL0sqfwp-hxPIf0m_L2ITklO2zkx5dAo

To claim this, I am signing this object:

@grant-h
grant-h / notfications.patch
Created September 18, 2019 16:20
CTFd RFC on notification pop ups
diff --git a/CTFd/api/v1/notifications.py b/CTFd/api/v1/notifications.py
index 6dd78f6..697a06f 100644
--- a/CTFd/api/v1/notifications.py
+++ b/CTFd/api/v1/notifications.py
@@ -31,6 +31,12 @@ class NotificantionList(Resource):
def post(self):
req = request.get_json()
+ pop_up = req.get('pop_up')
+
@grant-h
grant-h / bhwatch.py
Created June 4, 2020 15:46
Watch Black Hat's session API for changes.
#!/usr/bin/env python3
"""
BlackHat USA session watcher
by Grant Hernandez.
Monitor sessions (briefings) to see when new ones are added.
Tested: Thu Jun 4 11:41:59 EDT 2020
"""
import requests
@grant-h
grant-h / importmon.py
Created April 2, 2021 06:29
Hooking all Python imports to print the increase in pages and memory size (Linux only, Python 3.7 tested)
import sys
import importlib
class ImportInterceptor(importlib.abc.Loader):
def __init__(self):
pass
def find_module(self, fullname, path=None):
#sys.stderr.write("LOAD INFO: %s\n" % (fullname))
return self
@grant-h
grant-h / geoip-ctfd.patch
Created September 19, 2019 01:42
A working patch for GeoIP in CTFd
diff --git a/CTFd/auth.py b/CTFd/auth.py
index 91f7c73..410ffab 100644
--- a/CTFd/auth.py
+++ b/CTFd/auth.py
@@ -22,6 +22,8 @@ from CTFd.utils.modes import TEAMS_MODE, USERS_MODE
from CTFd.utils.security.signing import serialize, unserialize, SignatureExpired, BadSignature, BadTimeSignature
from CTFd.utils.helpers import info_for, error_for, get_errors, get_infos
from CTFd.utils.config.visibility import registration_visible
+from CTFd.utils.user import get_ip
+from CTFd.utils.countries import lookup_geoip_country_code, lookup_country_code
@grant-h
grant-h / HL1-BSP.bt
Last active January 10, 2022 00:50
An 010 Editor Binary Template (BT) for HL1 BSP files
//--------------------------------------
//--- 010 Editor v8.0 Binary Template
//
// Author: grant-h
// Purpose: 010 Editor Binary Template for HL1 BSP files
// Based from https://gist.github.com/rhulha/b7bd3d43104bf80b619ae454a8b9e439
// And from http://hlbsp.sourceforge.net/index.php?content=bspdef#texinfo
//--------------------------------------
LittleEndian();