Skip to content

Instantly share code, notes, and snippets.

View gunnihinn's full-sized avatar

Gunnar Þór Magnússon gunnihinn

View GitHub Profile
@gunnihinn
gunnihinn / conda-run.bat
Created June 13, 2019 14:50
Run a command inside a Conda environment on Windows
@ECHO OFF
:: Run a command inside the %pyenv% conda environment and exit
:: Because 'conda run' is a lie
SET interactive=0
SET pyenv=base
ECHO %CMDCMDLINE% | FINDSTR /L %COMSPEC% >NUL 2>&1
IF %ERRORLEVEL% == 0 SET interactive=1
#!/usr/bin/env python3
def binomial(n, k):
"""
A fast way to calculate binomial coefficients by Andrew Dalke.
See http://stackoverflow.com/questions/3025162/statistics-combinations-in-python
"""
if 0 <= k <= n:
ntok = 1
ktok = 1
#!/usr/bin/env python3
import sys
def findJobsSection(tag):
return tag.name == 'section' and tag.has_attr('class') and 'job-listing' in tag['class']
def parseJob(li):
a_tag = li.a
return {