Skip to content

Instantly share code, notes, and snippets.

View guanix's full-sized avatar

Guan Yang guanix

  • 44FE 23DB 362F 611C 0CC3 116B D49B 113D 48DC 370E
  • New York
View GitHub Profile
@guanix
guanix / zoeytest.py
Created October 5, 2020 15:20
Zoey REST API request in Python
from requests_oauthlib import OAuth1Session
import pprint
client_key = os.environ["ZOEY_CONSUMER_KEY"]
client_secret = os.environ["ZOEY_CONSUMER_SECRET"]
oauth_token = os.environ["ZOEY_OAUTH_TOKEN"]
oauth_secret = os.environ["ZOEY_OAUTH_SECRET"]
zoey = OAuth1Session(
client_key,

Notes on using ZFS on a Mac

I decided to move a big chunk of the data on my everyday Mac to ZFS. Here are some of my notes.

Why ZFS?

Compression

Compression is the killer feature for casual users. I only have 1TB of storage in my MacBook Pro, and I was constantly running out of space. A lot of the files I store compress very well, for example my Mail archive, source code, applications and Parallels virtual machines. The overall compression ratio for my pool is currently 2.06×.

@guanix
guanix / bogosort.jl
Last active January 1, 2016 16:39
Bogosort and Bogobogosort in Julia
function bogosort(v::Array)
if length(v) == 1
return v
end
c = deepcopy(v)
while !issorted(c)
shuffle!(c)
end

StartCom is a good CA for S/MIME. You need to create an account, verify your email address, then create a certificate for S/MIME email. Key generation looks like it happens on their side, but it actually occurs in the browser using the tag.

Once the certificate and key are in OS X Keychain, export it into a p12 file, use a good passphrase, and email it to yourself. Then open it up on the iOS device and install the certificate.

You'll also need to install the StartCom Class 1 Intermediate Client CA certificate. Open this link in Mobile Safari:

https://www.startssl.com/certs/sub.class1.client.ca.crt

(That certificate is in turn signed by the StartCom root CA, and as far as I know that's already trusted by iOS. There should be no need to explicitly trust any certificate. If necessary, the root certificate is here: https://www.startssl.com/certs/ca.crt)

@guanix
guanix / homebrew-radio-swig-brew-doctor.txt
Created November 14, 2012 16:47
homebrew-radio brew doctor
Last login: Wed Nov 14 11:42:13 on ttys003
breguan-air:~ guan$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
@guanix
guanix / gnuradio-build.txt
Created November 14, 2012 16:45
homebrew-gnuradio build problem
Last login: Wed Nov 14 11:42:09 on ttys002
guan-air:~ guan$ brew update -
guan-air:~ guan$ brew install -v gnuradio
/usr/bin/env python -c import Cheetah
/usr/bin/env python -c import scipy
/usr/bin/env python -c import lxml
/usr/bin/env python -c import matplotlib
/usr/bin/env python -c import numpy
==> Downloading http://gnuradio.org/releases/gnuradio/gnuradio-3.6.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/gnuradio-3.6.1.tar.gz
@guanix
guanix / gist:3159826
Created July 22, 2012 14:14
Test gist

Test gist

This is my test git.

@guanix
guanix / grove.pem
Created February 22, 2012 18:01
grove certificate
-----BEGIN CERTIFICATE-----
MIIHDjCCBfagAwIBAgIDBBa4MA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJ
TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0
YWwgQ2VydGlmaWNhdGUgU2lnbmluZzE4MDYGA1UEAxMvU3RhcnRDb20gQ2xhc3Mg
MSBQcmltYXJ5IEludGVybWVkaWF0ZSBTZXJ2ZXIgQ0EwHhcNMTEwODI2MTM1MzU5
WhcNMTIwODI2MTczMjUwWjBcMSAwHgYDVQQNExc0OTQzMDQtN1NWSndHZTB4RDcz
N3FwMDEVMBMGA1UEAxMMd3d3Lmdyb3ZlLmlvMSEwHwYJKoZIhvcNAQkBFhJ3ZWJt
YXN0ZXJAZ3JvdmUuaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx
lz4vg37hC8HCr9wLq/liypbSC7pi2IpMmuz5uWFfCAfO143sDKlDafkVfQ49O5Ar
jNzt2/PcKVs4+xw+sA0ATyb75J1Kw90vznwVhl5rSa1Od3tFavaRBRnFnA2albuN
@guanix
guanix / gist:1529261
Created December 28, 2011 19:21
NYT spam, analysis
Last login: Wed Dec 28 14:19:53 on ttys000
Guans-MacBook-Air:~ guan$ host dmx1.bfi0.com.
dmx1.bfi0.com has address 208.70.143.4
dmx1.bfi0.com mail is handled by 10 dmx1.bfi0.com.
Guans-MacBook-Air:~ guan$ host dmailer0121.dmx1.bfi0.com.
dmailer0121.dmx1.bfi0.com has address 208.70.142.121
Guans-MacBook-Air:~ guan$ nslookup 208.70.142.121
Server: 8.8.8.8
Address: 8.8.8.8#53
@guanix
guanix / gist:1529231
Created December 28, 2011 19:12
NYT spam
Delivered-To: guan@unicast.org
Received: by 10.220.155.201 with SMTP id t9cs190052vcw;
Wed, 28 Dec 2011 10:38:46 -0800 (PST)
Received: by 10.101.111.11 with SMTP id o11mr5634655anm.40.1325097524828;
Wed, 28 Dec 2011 10:38:44 -0800 (PST)
Return-Path: <1c6df7f9blayfovciab7saeiaaaaaazy4ddqqoseiuiyaaaaa@email.newyorktimes.com>
Received: from dmx1.bfi0.com (dmailer0121.dmx1.bfi0.com. [208.70.142.121])
by mx.google.com with ESMTP id d50si29937960yhh.16.2011.12.28.10.38.44;
Wed, 28 Dec 2011 10:38:44 -0800 (PST)
Received-SPF: pass (google.com: domain of 1c6df7f9blayfovciab7saeiaaaaaazy4ddqqoseiuiyaaaaa@email.newyorktimes.com designates 208.70.142.121 as permitted sender) client-ip=208.70.142.121;