<commit_before>---
# devmem2 isn't available on debian, and is trivial, so we just build it

- name: Copy devmem2 source
  copy:
    src: devmem2.c
    dest: /tmp/devmem2.c

- name: build devmem2 binary in expected location
  command: gcc -o /usr/bin/devmem2 /tmp/devmem2.c
  args:
    creates: /usr/bin/devmem2
    
- name: Expand Temp directory otherwise we will run out of space
  command: mount -o remount,size=400M /tmp/
  when: connectbox_os != "raspbian"

- name: Expand swapfile
  command: fallocate -l 400M /swapfile
  register: command_result
  ignore_errors: yes
  when: connectbox_os != "raspbian"


- name: fill swapfile
  command: dd if=/dev/zero of=/swapfile bs=1024 count=409600
  register: command_result
  ignore_errors: yes
  when: connectbox_os != "raspbian"

- name: change swap mode
  command: chmod 600 /swapfile
  when: connectbox_os != "raspbian"

- name: make it a swapfile
  command: mkswap /swapfile
  register: command_result
  ignore_errors: yes

- name: turn swapfile on
  command: swapon /swapfile
  register: command_result
  ignore_errors: yes 
  when: connectbox_os != "raspbian"

- name: Enable fstab change
  lineinfile:
    path: /etc/fstab
    line: '/swapfile swap sw rw, nodev, nosuid, size=400M 0 0\n'
    state: present
    create: yes
  when: connectbox_os != "raspbian"

- name: Install packages to allow building of pillow and psutil, running of OLED and direct mem writes
  apt:
    name: ['libjpeg-turbo8', 'python3-dev', 'libfreetype6', 'libfreetype6-dev','zlib1g-dev', 'libpng-dev', 'devmem2']
    state: present

- name: Make neo battery shutdown virtualenv directory
  file:
    path: "{{ hat_service_virtualenv_dir }}"<commit_msg>Changed ansible method of mode setting swapfile<commit_after>---
# devmem2 isn't available on debian, and is trivial, so we just build it

- name: Copy devmem2 source
  copy:
    src: devmem2.c
    dest: /tmp/devmem2.c

- name: build devmem2 binary in expected location
  command: gcc -o /usr/bin/devmem2 /tmp/devmem2.c
  args:
    creates: /usr/bin/devmem2
    
- name: Expand Temp directory otherwise we will run out of space
  command: mount -o remount,size=400M /tmp/
  when: connectbox_os != "raspbian"

- name: Expand swapfile
  command: fallocate -l 400M /swapfile
  register: command_result
  ignore_errors: yes
  when: connectbox_os != "raspbian"


- name: fill swapfile
  command: dd if=/dev/zero of=/swapfile bs=1024 count=409600
  register: command_result
  ignore_errors: yes
  when: connectbox_os != "raspbian"

- name: change swap mode
  file:
    path: /swapfile
    mode: 600
  when: connectbox_os != "raspbian"

- name: make it a swapfile
  command: mkswap /swapfile
  register: command_result
  ignore_errors: yes

- name: turn swapfile on
  command: swapon /swapfile
  register: command_result
  ignore_errors: yes 
  when: connectbox_os != "raspbian"

- name: Enable fstab change
  lineinfile:
    path: /etc/fstab
    line: '/swapfile swap sw rw, nodev, nosuid, size=400M 0 0\n'
    state: present
    create: yes
  when: connectbox_os != "raspbian"

- name: Install packages to allow building of pillow and psutil, running of OLED and direct mem writes
  apt:
    name: ['libjpeg-turbo8', 'python3-dev', 'libfreetype6', 'libfreetype6-dev','zlib1g-dev', 'libpng-dev', 'devmem2']
    state: present

- name: Make neo battery shutdown virtualenv directory
  file:
    path: "{{ hat_service_virtualenv_dir }}"
{'fraction_non_alphanumeric': 0.09850483729111698, 'fraction_numerical': 0.022280856053943126, 'mean_word_length': 3.610810810810811, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '398508', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1170, 'n_words': 379}