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 / hello.c
Last active August 2, 2022 06:12
A 400 byte, alternative "Hello world!"
// Run with gcc -o hello hello.c && ./hello
// An alternative "Hello World!" By DigitalCold
#include<unistd.h>
#include<errno.h>
main(){char*s=&errno,
*a=s,*t="@?>=",*z=t,
h[]={12,29,7,0,3,177,
87,-8,3,-6,-8,189,233,
1};for(;*z;s--){for(
;access(s,0),*a==14;
@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 / 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 / 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 / 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();
@grant-h
grant-h / exploit.py
Last active July 30, 2023 05:27
Pwntools template
#!/usr/bin/env python
# coding: utf-8
import sys
import time
# pip install pwn
from pwn import *
# pip install ipython
from IPython import embed
@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 / 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