<commit_before>#!/usr/bin/env python
# Copyright 2016 <NAME>. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.

"""Fetches Raspbian Jessie Lite and flash it to an SDCard.

Then it updates the SDCard so it automatically self-initializes on
first boot.
"""

import argparse
import glob
import os
import re
import shutil
import subprocess
import sys
import time
import zipfile


BASE = os.path.dirname(os.path.abspath(__file__))


WPA_SUPPLICANT = """
network={
  ssid="%s"
  psk="%s"
}
"""


FIVE_INCHES = """
# Enable support for 800x480 display:
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0

# Enable touchscreen:
# Not necessary on Jessie Lite since it boots in console mode. :)
# Some displays use 22, others 25.
# Enabling this means the SPI bus cannot be used anymore.
#dtoverlay=ads7846,penirq=22,penirq_pull=2,speed=10000,xohms=150
"""


RC_LOCAL = """
#!/bin/sh -e
# Copyright 2016 <NAME>. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.

# Part of https://github.com/maruel/bin_pub

LOG_FILE=/var/log/firstboot.log
if [ ! -f $LOG_FILE ]; then
  /root/firstboot.sh 2>&1 | tee $LOG_FILE
fi
exit 0
"""


def check_call(*args):
  env = os.environ.copy()
  env['LANG'] = 'C'
  subprocess.check_call(args, env=env)


def check_output(*args):
  env = os.environ.copy()
  env['LANG'] = 'C'
  return subprocess.check_output(args, env=env, stderr=subprocess.STDOUT)<commit_msg>Fix typo in flash.py leading to broken rc.local<commit_after>#!/usr/bin/env python
# Copyright 2016 <NAME>. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.

"""Fetches Raspbian Jessie Lite and flash it to an SDCard.

Then it updates the SDCard so it automatically self-initializes on
first boot.
"""

import argparse
import glob
import os
import re
import shutil
import subprocess
import sys
import time
import zipfile


BASE = os.path.dirname(os.path.abspath(__file__))


WPA_SUPPLICANT = """
network={
  ssid="%s"
  psk="%s"
}
"""


FIVE_INCHES = """
# Enable support for 800x480 display:
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0

# Enable touchscreen:
# Not necessary on Jessie Lite since it boots in console mode. :)
# Some displays use 22, others 25.
# Enabling this means the SPI bus cannot be used anymore.
#dtoverlay=ads7846,penirq=22,penirq_pull=2,speed=10000,xohms=150
"""


RC_LOCAL = """#!/bin/sh
# Copyright 2016 <NAME>. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.

# Part of https://github.com/maruel/bin_pub

set -e

LOG_FILE=/var/log/firstboot.log
if [ ! -f $LOG_FILE ]; then
  /root/firstboot.sh 2>&1 | tee $LOG_FILE
fi
exit 0
"""


def check_call(*args):
  env = os.environ.copy()
  env['LANG'] = 'C'
  subprocess.check_call(args, env=env)


def check_output(*args):
  env = os.environ.copy()
  env['LANG'] = 'C'
  return subprocess.check_output(args, env=env, stderr=subprocess.STDOUT)
{'fraction_non_alphanumeric': 0.11314791403286978, 'fraction_numerical': 0.0347661188369153, 'mean_word_length': 4.248756218905473, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '4962785', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1091, 'n_words': 377}