Skip to content

Instantly share code, notes, and snippets.


weixiang lesywix

View GitHub Profile
lesywix /
Created Feb 6, 2022 — forked from progrium/
Setting up M1 Macs for x86 development with Homebrew

Key Points

  • In general, binaries built just for x86 architecture will automatically be run in x86 mode
  • You can force apps in Rosetta 2 / x86 mode by right-clicking app, click Get Info, check "Open using Rosetta"
  • You can force command-line apps by prefixing with arch -x86_64, for example arch -x86_64 go
  • Running a shell in this mode means you don't have to prefix commands: arch -x86_64 zsh then go or whatever
  • Don't just immediately install Homebrew as usual. It should most likely be installed in x86 mode.


Not all toolchains and libraries properly support M1 arm64 chips just yet. Although

lesywix /
Created Feb 26, 2020
A simple cache of ttl base
import collections
import threading
from time import monotonic as default_timer
except ImportError:
from time import time as default_timer
class TTLCache:
lesywix /
Last active Jun 1, 2018
Check if django DB migrations is not synchronized. Import `exit_if_db_not_synchronized` in
# coding: utf-8
from __future__ import absolute_import
import functools
from django.db import close_old_connections, connections, DEFAULT_DB_ALIAS
from django.db.migrations.executor import MigrationExecutor
def close_connection_after_call(f):