Skip to content

Instantly share code, notes, and snippets.

View tekknolagi's full-sized avatar
🚴

Max Bernstein tekknolagi

🚴
View GitHub Profile
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# https://github.com/dart-lang/sdk/blob/5db6b482b07d0d4e67a45d95cce2f405bcf98b04/runtime/third_party/binary_size/src/elf_symbolizer.py
import collections
import datetime
import logging
import multiprocessing
import os
@tekknolagi
tekknolagi / processify.py
Created October 31, 2022 22:36 — forked from schlamar/processify.py
processify
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.
Be sure that every argument and the return value
#!/bin/bash
PYPY=~/Downloads/pypy-c-jit-106258-39dc1c343c50-linux64
PYTHONPATH="${PYPY}:${PYPY}/pypy" \
"${PYPY}"/bin/pypy \
"${PYPY}"/pypy/rpython \
-O2 --batch targetlox.py
#include <stdio.h>
#define IS_DIG(x) (((x)|1)=='1')
#define SLEN(s) ((sizeof s)-1)
#define RIDX(s,x) ((x)<SLEN(s)?s[SLEN(s)-1-(x)]:0)
#define CNT(s,x,n) ((x)<n?IS_DIG(RIDX(s,(x))):0)
#define CNT4(s,x,n) (CNT(s,x+0,n)+CNT(s,x+1,n)+CNT(s,x+2,n)+CNT(s,x+3,n))
#define CNT16(s,x,n) (CNT4(s,x+0,n)+CNT4(s,x+4,n)+CNT4(s,x+8,n)+CNT4(s,x+12,n))
#define CNT64(s,x,n) (CNT16(s,x+0,n)+CNT16(s,x+16,n)+CNT16(s,x+32,n)+CNT16(s,x+48,n))
#define VAL(s,x) ((RIDX(s,x)=='1')<<(CNT64(s,0,x)))
#define VAL4(s,x) (VAL(s,x+0)+VAL(s,x+1)+VAL(s,x+2)+VAL(s,x+3))
@tekknolagi
tekknolagi / python_make_github_issues.py
Created October 11, 2022 23:11 — forked from nqthqn/python_make_github_issues.py
Creates GitHub Issues from a CSV file.
import json
import requests
import csv
# Authentication for user filing issue (must have read/write access to
# repository to add issue to)
USERNAME = 'username'
PASSWORD = 'password'
# The repository to add this issue to
@tekknolagi
tekknolagi / sym_test.cc
Created October 8, 2022 03:09 — forked from aeppert/sym_test.cc
Enumerate and demangle symbols within an executable's own symbol table.
#include <stdio.h>
#include <stdlib.h>
#include <cxxabi.h>
#include <link.h>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
  • Compiling compression algorithms through programs
    • Compiler as f :: (program, compression algo) -> program'
  • Does collapsing towers of interpreters work for programming languages with much bigger architectural differences than the ones in the paper?
  • Abstract abstract interpretation
  • DDCG
  • Minecraft but it's all sending code to run on a shared VM
  • PL where every state change is persisted in a DB
  • SteamDrill (Quinn) but it's layered abstractions that you can expand (Python->C->asm) & custom events
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <depfile> <command...>" >&2
exit 1
fi
# The .d file we're going to write.
DEPSFILE=$1
shift
# Copyright Andy Chu
class switch(object):
"""A ContextManager that translates to a C switch statement."""
def __init__(self, value):
# type: (int) -> None
self.value = value
def __enter__(self):
# type: () -> switch
@tekknolagi
tekknolagi / run.py
Last active February 13, 2024 02:35
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
import shlex
import subprocess
import sys
import textwrap
def with_pty(command):