Skip to content

Instantly share code, notes, and snippets.

View mplanchard's full-sized avatar

Matthew Planchard mplanchard

View GitHub Profile
@mplanchard
mplanchard / ansible_sysfile.yaml
Last active February 5, 2017 01:01
ansible_sysfile
# Permission denied error
- name: ensure transparent huge pages are disabled
copy:
content: never
dest: "{{ celery_thp_file }}"
owner: root
group: root
mode: 0644
notify: restart redis-server service
become: yes
- name: Some play
hosts: some_hosts
roles:
- role: some_role
some_variable: variable value
another_variable: another value
@mplanchard
mplanchard / jados_itertools.py
Created April 21, 2016 22:06
Quick and dirty permutations script
from itertools import permutations
def get_combinations(layer):
possibles = (-layer, -layer + 1, 0, layer - 1, layer)
combinations = permutations(possibles, 2)
return_combinations = []
for combination in combinations:
if layer in combination or -layer in combination:
return_combinations.append(combination)
return return_combinations
@mplanchard
mplanchard / req_install.py
Created November 4, 2015 17:45
Pip Uninstall Entry Points
if dist.has_metadata('entry_points.txt'):
config = configparser.SafeConfigParser()
config.readfp(
FakeFile(dist.get_metadata_lines('entry_points.txt'))
)
if config.has_section('console_scripts'):
for name, value in config.items('console_scripts'):
if dist_in_usersite(dist):
bin_dir = bin_user
else: