Skip to content

Instantly share code, notes, and snippets.

View lukeorland's full-sized avatar

Luke Orland lukeorland

View GitHub Profile
---
- hosts: 127.0.0.1
connection: local
tasks:
- name: Remove file 0
file: name=/tmp/mycoolfile state=absent
- name: Touch file with async, dictionary syntax
command: touch mycoolfile
#!/usr/bin/env python
import time
from fabric.api import *
def two_secs():
t = time.time()
time.sleep(2)
return t
#!/usr/bin/env perl
# References:
# - http://stackoverflow.com/a/800105/492631
use warnings;
use strict;
# fork processes
my $num_cores = 4;
my @children = ();
#!/usr/bin/env python
"""
Graph the DAG of tasks
Modified from https://gist.github.com/BrianHicks/2769821
"""
import argparse
import json
import logging
@lukeorland
lukeorland / project.clj
Created November 23, 2015 13:19
clojure spacemacs repl nrepl plugins
:plugins [[refactor-nrepl "2.0.0-SNAPSHOT"]
[cider/cider-nrepl "0.10.0-SNAPSHOT"]]

Keybase proof

I hereby claim:

  • I am lukeorland on github.
  • I am orluke (https://keybase.io/orluke) on keybase.
  • I have a public key whose fingerprint is 50F6 A605 06CC 59DF 715B 1F0F 1307 0B06 3F6B E0F7

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
import argparse
import csv
import re
fields = ("Start Time", "End Time", "Activity", "Text", "Notes")
def parse_arguments():
parser = argparse.ArgumentParser(description='')
@lukeorland
lukeorland / concurrent_ThreadPoolExecutor.py
Last active October 20, 2017 14:25
python3 concurrent ThreadPoolExecutor
#!/usr/bin/env python3
import concurrent.futures
import time
def slumber(seconds):
time.sleep(seconds)
print("slept %s seconds" % seconds)
@lukeorland
lukeorland / multiprocessing_pandas_apply.py
Last active September 12, 2019 20:00
easy multiprocessing apply pandas
import multiprocessing
pool = multiprocessing.Pool(processes=multiprocessing.cpu_count())
df['normalized_text'] = pool.map(normalize_text, df['text'])
pool.close()
pool.join()
@lukeorland
lukeorland / dir_containing_this.py
Created November 26, 2019 19:49
directory containing this Python file
import inspect
import os
def get_dir_containing_this_file():
return os.path.dirname(
os.path.abspath(
inspect.getframeinfo(
inspect.currentframe()).filename))