Skip to content

Instantly share code, notes, and snippets.

@rachtsingh
rachtsingh / heap.c
Created September 15, 2018 22:19
Trying to access heap memory after it's been free'd
#include <stdio.h>
#include <stdlib.h>
// void * return type means that it returns a naked pointer, which is just an address.
void *foo(void) {
long *bar_ptr = malloc(sizeof(long));
*bar_ptr = 5;
printf("The data is held at address: %p, holds %ld bytes\n", bar_ptr, sizeof(long));
free(bar_ptr);
return (void *) bar_ptr;
#!/usr/local/bin/python3
"""
This script should idempotently grab the stuff that's newly added to Pocket to pocket.md
You'll need to install https://airtable-python-wrapper.readthedocs.io, i.e. via:
$ pip3 install airtable-python-wrapper
and, of course, sign up for an Airtable account (free seems to work fine).
"""
"""
This script exports the AutoGPT-Q Llama 2 weights in llama2rs.bin format.
"""
import pathlib
import click
import struct
import torch
from torch import nn
from auto_gptq import AutoGPTQForCausalLM
from auto_gptq.nn_modules import qlinear