Skip to content

Instantly share code, notes, and snippets.

Avatar

Kasper Primdal Lauritzen KPLauritzen

View GitHub Profile
@KPLauritzen
KPLauritzen / azure-pipeline.yaml
Created Apr 20, 2021
Pipeline for using micromamba in a azure devops pipeline
View azure-pipeline.yaml
jobs:
- job:
pool:
vmImage: 'vs2017-win2016'
variables:
- name: MAMBA_ROOT_PREFIX
value: $(Pipeline.Workspace)\micromambaenv
steps:
- powershell: |
Invoke-Webrequest -URI https://micro.mamba.pm/api/micromamba/win-64/latest -OutFile micromamba.tar.bz2
@KPLauritzen
KPLauritzen / test_asap_crash.py
Created Apr 7, 2017
Succeeds with `--size 7`, fails with `--size 8`
View test_asap_crash.py
from __future__ import print_function
import numpy as np
import argparse
from ase.units import kB, fs
from ase.build import fcc111
from asap3 import EMT
from asap3.md.langevin import Langevin
@KPLauritzen
KPLauritzen / lol.py
Created Feb 14, 2017
Kill random process with python
View lol.py
from subprocess import call
import random
while True:
try:
call(["kill", "-9", random.randint(0, 9999)]
except:
print("ayy lmao")
sleep(5)
View useful_pandas_snippets.py
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]