Skip to content

Instantly share code, notes, and snippets.

# Expanded version of Glyph's example at
# https://mastodon.social/@glyph/112628092787725236
def loop():
for number in range(10):
def closure():
print("Inside the closure")
return number
print("Before yield")
yield closure
#!/bin/bash
set -e
set -u
# This script "floats" any number of local branches
# on top of a chosen base branch. So, when the base
# branch gets updated, it will move your whole tree
# of local branches on top of the new commits.
#

Thistle and Shamrock radio streams

On October 2, 2024, Fiona Ritchie brought to a close 43 years of broadcasting The Thistle and Shamrock her iconic weekly Celtic music radio show. There will be no more new episodes. It's the end of an era.

You can listen to her farewell episode archived on the NPR Music site. Some other old episodes are there too.

Fiona's Thistle Radio channel is still playing on SomaFM.

@christianmlong
christianmlong / obsolete_pytest.txt
Created July 20, 2015 20:12
How to uninstall the obsolete version of pytest that pylint comes with
# Are we in a virtual environment? We can't return values from bash functions.
# Instead, in the calling function, use command substitution to get the result.
# For example:
# MY_VAR=$(in_virtualenv)
function in_virtualenv
{
python -c 'import sys; print(sys.real_prefix)' > /dev/null 2>&1 && INVENV=1 || INVENV=0
echo "$INVENV"
}
@christianmlong
christianmlong / tmux_sync_env.sh
Created July 18, 2015 17:35
Synchronise tmux's ssh env variables after reconnection
# Sync the environment of an existing shell
#
# tmux already updates the environment according to
# the update-environment settings in the config. However
# for existing shells you need to sync from from tmux's view
# of the world.
function tmux_sync_env
{
ssh_auth_sock=`tmux showenv | grep "^SSH_AUTH_SOCK"`
ssh_connection=`tmux showenv | grep "^SSH_CONNECTION"`

2015

July

2015-07-16 12:20, Homebrew and Postgres

I spent some time figuring out how to install several different versions of PostGresql on my mac. With Homebrew nowadays, you do this

(twisted) C:\Users\Me\twisted-test>pip install --no-use-wheel twisted
Collecting twisted
Downloading Twisted-15.0.0.tar.bz2 (4.4MB)
100% |################################| 4.4MB 73kB/s
Requirement already satisfied (use --upgrade to upgrade): zope.interface>=3.6.0 in c:\pythonenvs\twisted\lib\site-packages (from twisted)
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\pythonenvs\twisted\lib\site-packages (from zope.interface>=3.6.0->twisted)
Installing collected packages: twisted
Running setup.py install for twisted
C:\Users\Me\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\PythonEnvs\twisted\PC /Tcconftest.c /Foconftest.obj
conftest.c
@christianmlong
christianmlong / nosetests vs py.test
Created March 12, 2015 21:52
Nosetests failure and py.test failure
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
Clink v0.4.3 [git:258fc3] Copyright (c) 2014 Martin Ridgers
http://mridgers.github.io/clink
C:\Users\Me>workon.bat f8
(f8) C:\Users\Me\Documents\Documents\Computer\Projects\git\flake8>pip list
astroid (1.3.4)
colorama (0.3.3)

Keybase proof

I hereby claim:

  • I am christianmlong on github.
  • I am christianmlong (https://keybase.io/christianmlong) on keybase.
  • I have a public key whose fingerprint is 0DDB CD19 3B2B 8AD6 AAF9 A5B4 031A 48F5 617A F959

To claim this, I am signing this object: