Skip to content

Instantly share code, notes, and snippets.

View acharles7's full-sized avatar
💭
open-source

Charles Patel acharles7

💭
open-source
View GitHub Profile
@matangover
matangover / Python native libs on macOS with M1.md
Last active April 9, 2024 18:12
Allow Python on macOS M1 to import native libraries installed using Homebrew

Your Problem

  1. You are using Python on macOS M1 (or M2, etc) and are trying to install a Python library which uses a native library.
  2. You install the Python library (e.g. using pip) and the native library (using Homebrew).
  3. You get an error saying that the native library cannot be located even though it's installed using Homebrew.

Example: You are trying to use e.g. pyfluidsynth. You've installed pyfluidsynth with pip, and also ran brew install fluidsynth. However, import fluidsynth still gives an error:

ImportError: Couldn't find the FluidSynth library.
@yarshure
yarshure / iphone12_iOS_keys.txt
Created May 17, 2021 04:31
gestalt_query keys
Key Name Description
======== ===========
3GProximityCapability Whether the device has a 3G proximity sensor
3GVeniceCapability Whether the device supports FaceTime over cellular
720pPlaybackCapability Whether the device supports 720p video (identical to kMGQDeviceSupports720p)
APNCapability
ARM64ExecutionCapability Whether the device supports executing arm64 binaries
ARMV6ExecutionCapability Whether the device supports executing armv6 binaries
ARMV7ExecutionCapability Whether the device supports executing armv7 binaries
ARMV7SExecutionCapability Whether the device supports executing armv7s binaries
@amarao
amarao / blame-praise.py
Last active September 23, 2024 02:22
Example of argparse with subparsers for python
#!/usr/bin/env python
import argparse
def main(command_line=None):
parser = argparse.ArgumentParser('Blame Praise app')
parser.add_argument(
'--debug',
action='store_true',
help='Print debug info'
@karpathy
karpathy / min-char-rnn.py
Last active November 7, 2024 06:35
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)
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs