Skip to content

Instantly share code, notes, and snippets.

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
@mbelletti
mbelletti / music_theory.py
Created April 22, 2021 17:29 — forked from mvanga/music_theory.py
Basic Music Theory in ~200 Lines of Python
# The code for my article with the same name. You can find it at the URL below:
# https://www.mvanga.com/blog/basic-music-theory-in-200-lines-of-python
# MIT License
#
# Copyright (c) 2021 Manohar Vanga
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@mbelletti
mbelletti / 1-original.md
Created February 12, 2019 17:22 — forked from chadselph/1-original.md
gsm encoding for python

(From http://stackoverflow.com/questions/2452861/python-library-for-converting-plain-text-ascii-into-gsm-7-bit-character-set, ran out of space in the comment section.)

Running the original file does not work in either Python 2 or 3.

In Python2, the program prints this:

64868d8d903a7390938d85

(which is wrong) because it is using the indexes of gsm which do not map to the index of their GSM encodings due to the fact that it is a bytestring with some characters taking up multiple bytes. gsm is actually equal to

@mbelletti
mbelletti / Output
Created February 8, 2019 21:26 — forked from macournoyer/Output
A Neural Network framework in 25 LOC
$ python xor.py
Training:
Epoch 0 MSE: 1.765
Epoch 100 MSE: 0.015
Epoch 200 MSE: 0.005
* Target MSE reached *
Evaluating:
1 XOR 0 = 1 ( 0.904) Error: 0.096
0 XOR 1 = 1 ( 0.908) Error: 0.092
1 XOR 1 = 0 (-0.008) Error: 0.008

Keybase proof

I hereby claim:

  • I am mbelletti on github.
  • I am mbelletti (https://keybase.io/mbelletti) on keybase.
  • I have a public key ASDZlvEC_Rppnz4vVIv1Y9UWC5sbqdcnukd8UbqtU606RAo

To claim this, I am signing this object:

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@mbelletti
mbelletti / pydal_jsonb.py
Created June 14, 2017 09:46 — forked from gi0baro/pydal_jsonb.py
Add jsonb postgres support to pydal
# -*- coding: utf-8 -*-
"""
Adds some PostgreSQL jsonb support to pydal.
Check https://www.postgresql.org/docs/9.6/static/functions-json.html for additional info.
In order to use operators you must specify the 'jsonb' type on `Field` class.
Included query operators:
- `@>`: db.where(db.table.jsonb_field.jcontains({"foo": "bar"}))
- `<@`: db.where(db.table.jsonb_field.jin({"foo": "bar"}))
@mbelletti
mbelletti / happy_git_on_osx.md
Created January 10, 2017 22:08 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@mbelletti
mbelletti / ros-enable-l2tp.sh
Created September 17, 2016 10:05 — forked from wsvn53/ros-enable-l2tp.sh
Ros enable l2tp instructions.
/ip pool
add name=vpn-pool ranges=10.2.2.2-10.2.2.22
/ppp profile
set [find name=default-encryption] dns-server=10.2.2.1 local-address=10.2.2.1 remote-address=vpn-pool
/ppp secret
add name=帳號 password=密碼 profile=default
/interface l2tp-server server