Skip to content

Instantly share code, notes, and snippets.

@floer32
floer32 / _fix_pip_import_error.md
Last active June 24, 2022 10:44
fix that pesky "ImportError: No module named packaging.version" problem. Or more generally, if you need to fix pip using pip, just make sure you do "python -m pip" instead of straight-up "pip".

It can come up while installing anything really. I'm not sure exactly which versions of pip are affected, I know I had 1.5.6 and it was affected.

These examples are grabbed from my system level Python, but of course you should use a virtualenv.

  Running setup.py install for simplegeneric
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 12, in <module>
        import setuptools.version
@migeorge
migeorge / custom.sh
Created February 15, 2017 02:27
DD-WRT DigitalOcean Dynamic DNS
IPADDR=$(nvram get wan_ipaddr)
DO_KEY="Your DigitalOcean API Key"
DOMAIN="yourdomain.name"
DO_RECORD_ID=id_for_record_you_want_to_update
echo $IPADDR
echo Updating name server
curl -k "https://api.digitalocean.com/v2/domains/$DOMAIN/records/$DO_RECORD_ID" \
-X PUT \
@wrossmann
wrossmann / DoveadmAuth.php
Created November 28, 2013 00:47
Quick, dirty, simple PHP to use `doveadm auth` to validate a user's plaintext password against the stored hash without exposing the password through shell commands. Note: This assumes that you already have dovecot's auth backend set up and working. Also, there does not appear to be a simple way to feed in a pre-computed hash, it will only use th…
<?php
class DoveadmAuth {
public static function auth($username, $password) {
$descriptors = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w'),
);
$cwd = sys_get_temp_dir();
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: