Skip to content

Instantly share code, notes, and snippets.

@razamatan
razamatan / 00README.md
Last active February 1, 2024 10:11
clean gentoo WSL2 setup with automounting encrypted home partition

mounting dmcrypted disks/partitions using openrc in wsl2

This assumes you can find and follow other directions elsewhere. github is silly w/ not allowing / in filenames, so i used \.

  1. install gentoo on wsl2 and make sure your starting openrc at wsl boot
  2. follow https://medium.com/@stefan.berkner/automatically-starting-an-external-encrypted-ssd-in-windows-subsystem-wsl-6403c34e9680 to get your disk setup. if you follow that, it's encrypting an entire drive, but you can do partitions or whatever disk setup you want for your linux setup. the key thing is that you need to pass the entire drive (--bare) to let linux
$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: d0a2ed907ddb750c519bb9f56d7055490f968edf
HOMEBREW_PREFIX: /usr/local/homebrew
HOMEBREW_CELLAR: /usr/local/homebrew/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.8.3-x86_64
Xcode: 4.6.1
CLT: 4.6.0.0.1.1362189000
@razamatan
razamatan / xmlhelp.py
Created March 10, 2011 01:26
simple conversion from etree parsed xml to objects
''' xml utilities '''
__author__ = 'jin@recessnetworks.net'
from itertools import groupby
from operator import attrgetter
def split_ns(txt):
''' returns [ns, tag] for '{ns}tag'
>>> split_ns('{http://www.w3.org/2001/XMLSchema-instance}nil')
@razamatan
razamatan / ZSI.wstools.Utility.py
Created February 8, 2011 22:43
fix for ZSI 2.0 and python 2.6's ssl handling
# in class TimeoutHTTPS:
def connect(self):
sock = TimeoutSocket(self.timeout)
sock.connect((self.host, self.port))
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
@razamatan
razamatan / randomize iterator in python
Created December 10, 2010 10:10
randomize python iterator
from random import shuffle, randrange
def randomize(iterable, bufsize=1000):
''' generator that randomizes an iterable. space: O(bufsize). time: O(n). '''
buf = list()
for x in iterable:
if len(buf) == bufsize:
i = randrange(bufsize)
yield buf[i]
buf[i] = x