Skip to content

Instantly share code, notes, and snippets.

View dluman's full-sized avatar

Douglas Luman dluman

View GitHub Profile
@m0sys
m0sys / build_gdb.sh
Last active December 18, 2023 19:10
Apple M1 ARM GDB Build from Source with Python Support
#!/usr/bin/env sh
# NOTE: First, have to ignore the following warnings to make it build on M1 Chip.
#
# -Wno-constant-logical-operand -Wno-format-nonliteral -Wno-self-assign
#
# To do so the above line should be appended to consts CFLAGS and CXXFLAGS
# under the 'Programs producing files for the HOST machine' section of
# the generated Makefile in dir 'build-gdb'.
@bitbug42
bitbug42 / OpReturn.cs
Last active June 20, 2020 12:57
Scan Bitcoin blocks, looking for OP_RETURN outputs containing text. Requires a synced fullnode and the NBitcoin library
using NBitcoin;
using NBitcoin.RPC;
using System;
using System.IO;
using System.Linq;
using System.Text;
class OpReturnScan
{
@aparrish
aparrish / enough-python.ipynb
Last active September 16, 2023 16:16
Just enough Python!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from PyPDF2.generic import (
DictionaryObject,
NumberObject,
FloatObject,
NameObject,
TextStringObject,
ArrayObject
)
# x1, y1 starts in bottom left corner
@aparrish
aparrish / index.md
Last active December 2, 2021 13:26
Writing Poetry with Procedure: A Workshop

Writing Poetry with Procedure: A Workshop

Led by Allison Parrish

Description

Practitioners in the field of procedural writing have been using rules, procedures and computer programs to create innovative literary work since the invention of the digital computer. Far from the bland imitation evoked by the phrase "computer-generated poetry," these techniques facilitate the creation of work with aesthetic and emotional affordances sometimes difficult to achieve through conventional compositional techniques: serendipitous beauty, precisely imitative satire, vertiginous wonder at the infinite. In this workshop, participants will learn about the history of computer-generated writing and sample a range of off-the-shelf, freely-available tools on the web to create their own—without writing any actual lines of code. No previous programming experience is required.

Outline

@karpathy
karpathy / min-char-rnn.py
Last active May 1, 2024 11:00
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@karpathy
karpathy / gist:587454dc0146a6ae21fc
Last active March 19, 2024 05:50
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@cbare
cbare / dynamic_object.py
Created January 31, 2013 01:07
How to get a dynamic object in Python. A dynamic object is just a bag of properties, some of which might happen to be functions, just like objects in javascript. Forget OOP. This is QDP - quick-n-dirty programming!
class Dynamic(dict):
"""Dynamic objects are just bags of properties, some of which may happen to be functions"""
def __init__(self, **kwargs):
self.__dict__ = self
self.update(kwargs)
def __setattr__(self, name, value):
import types
if isinstance(value, types.FunctionType):
self[name] = types.MethodType(value, self)