Skip to content

Instantly share code, notes, and snippets.

Ryan Govostes rgov

Block or report user

Report or block rgov

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
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Map demo</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css" />
<script src="https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw-src.js"></script>
View shelldiff.sh
#!/bin/sh
TMPDIR="$(mktemp -d)"
# Capture the default shell options, before we enter POSIX mode
set +o | sort > "$TMPDIR/shellopts.old"
echo "set -$-" >> "$TMPDIR/shellopts.old"
set -o posix
# Capture global variables
View dockerize.py
#!/usr/bin/env python
# Copyright (C) 2019 Woods Hole Oceanographic Institution
#
# This file is part of the CGSN Mooring Project ("cgsn-mooring").
#
# cgsn-mooring is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
View cryptoscope-crack.py
#!/usr/bin/env python
import random
# Here is our plaintext message
message = 'THISISATESTITISONLYATEST'
# Insert random spaces into the message
while len(message) < 72:
i = random.randrange(len(message))
@rgov
rgov / gist:77d71681ae3a9cee6792d90fb490dd16
Created Apr 16, 2019
crash course in managing a database with django-admin
View gist:77d71681ae3a9cee6792d90fb490dd16
# See also:
# https://docs.djangoproject.com/en/2.2/intro/tutorial01/
# Install Django
python -m pip install django
# This creates a blank new Django project in mysite/
django-admin startproject mysite
cd mysite/
@rgov
rgov / gist:32acd7005c175fed68e86a82d58d5b81
Created Apr 16, 2019
crash course in managing a database with django-admin
View gist:32acd7005c175fed68e86a82d58d5b81
# See also:
# https://docs.djangoproject.com/en/2.2/intro/tutorial01/
# Install Django
python -m pip install django
# This creates a blank new Django project in mysite/
django-admin startproject mysite
cd mysite/
@rgov
rgov / tc32-asm.py
Created Apr 13, 2019
Telink TC32 instructions
View tc32-asm.py
'''
This is a list of opcodes for the TC32 MCU, as disassembled by the objdump
binary provided (without source) with the Telink IDE.
The format is (value, mask, assembly).
See
http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=opcodes/arm-dis.c;hb=HEAD#l2508
'''
[
@rgov
rgov / gist:f1fb93a34a6ec30fe88cf6602776b620
Created Apr 13, 2019
Ghidra - Dump array of structures
View gist:f1fb93a34a6ec30fe88cf6602776b620
# Quickly written script to enumerate an array of structures and dump them
# as a Python object for further processing.
#
# This is NOT a good example of Ghidra scripting; I basically figured out
# the API by brute force. Hopefully there is a more elegant way to do this.
#@author Ryan Govostes
#@category Data
#@keybinding
#@menupath
@rgov
rgov / gist:7e1135bd697790a2d9f09308fe2aaa11
Created Mar 27, 2019
Z3 example of finding parameters to a CRC-16 algorithm
View gist:7e1135bd697790a2d9f09308fe2aaa11
import crcmod
from z3 import *
# This is a CRC-16 algorithm coded to be able to use Z3's symbolic types
def crc16_py(buffer, initial, poly, xorout):
crc = initial
for b in buffer:
crc = crc ^ (b << 8)
for i in range(8):
crc = If(crc & 0x8000 != 0, (crc << 1) ^ poly, crc << 1)
@rgov
rgov / gist:cbee899187e6db489ef9a8460e8e6167
Created Mar 24, 2019
write to stdout after closing it?
View gist:cbee899187e6db489ef9a8460e8e6167
/* doesn't work */
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int main() {
close(STDOUT_FILENO);
if (open("/dev/null", O_WRONLY) != STDOUT_FILENO) {
fprintf(stderr, "Could not open /dev/null as fd %d", STDOUT_FILENO);
You can’t perform that action at this time.