• This repository has been archived on 15/Jun/2022
  • Stars
    star
    317
  • Rank 129,357 (Top 3 %)
  • Language
    Shell
  • License
    Other
  • Created over 9 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED: A shell script which turns your Mac into an awesome web development machine.

Laptop

Build Status

Laptop is a script to set up an OS X computer for web development, and to keep it up to date.

It can be run multiple times on the same machine safely. It installs, upgrades, or skips packages based on what is already installed on the machine.

Requirements

We support:

Older versions may work but aren't regularly tested. Bug reports for older versions are welcome.

Install

Begin by opening the Terminal application on your Mac. The easiest way to open an application in OS X is to search for it via Spotlight. The default keyboard shortcut for invoking Spotlight is command-Space. Once Spotlight is up, just start typing the first few letters of the app you are looking for, and once it appears, press return to launch it.

In your Terminal window, copy and paste the command below, then press return.

bash <(curl -s https://raw.githubusercontent.com/18F/laptop/master/laptop)

The script itself is available in this repo for you to review if you want to see what it does and how it works.

Note that the script will ask you to enter your OS X password at various points. This is the same password that you use to log in to your Mac. If you don't already have it installed, GitHub for Mac will launch automatically at the end of the script so you can set up everything you'll need to push code to GitHub.

Once the script is done, make sure to quit and relaunch Terminal.

More detailed instructions with a video are available in the Wiki.

It is highly recommended to run the script regularly to keep your computer up to date. Once the script has been installed, you'll be able to run it at your convenience by typing laptop and hitting return in your Terminal.

Want to install just git-seekret?

In your terminal window, copy and paste the following line, and press return:

curl -s https://raw.githubusercontent.com/18F/laptop/master/seekrets-install | bash -

Note that the script may ask you to enter your password. This is the same password that you use to log in to your computer.

git-seekret requires git 2.9.1 or higher. Some versions of Ubuntu ship with an older version. To update your git before installing git-seekret:

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update

git-seekret will install global git hooks into ~/.git-support/hooks. To restore pre-existing git hooks, it is recommended to save pre-existing hooks into a separate directory and to copy those hooks into ~/.git-support/hooks after git-seekret is installed.

Development

Git Seekret

This section covers contributing and developing new rulesets for git-seekrets.

The rules installed by the seekret-install script are located in the seekret-rules directory at the root of this repository. Inside each rule file is a list of rules. The rule file can be considered a tree with the rules as the leaves of the tree.

An example rule file is below:

thing_to_match:
  match: r[egx]{2,}p?
  unmatch:
    - some_prefix\s*r[egx]{2,}p?
    - r[egx]{2,}p?\s*some_suffix

Using the example above, let's break down each stanza:

  • thing_to_match : The name of the rule we'd like to match / unmatch. This can be anything that makes sense for the .rule file being created / edited.
  • match : A single regular expression which will be used to match any rules for the name above.
  • unmatch : A list of regular expressions which will be used to unmatch anything that the match rule matches.

Feel free to submit an issue/create a pull request in order to submit a new ruleset or to apply a modifification to an existing ruleset.

Testing Git Seekrets

You can test secret rulesets using BATS for automated testing and manually using the installation script.

Let's talk about BATS

Please read the local BATS documentation.

Let's talk about local manual testing

To install the *.rule files located in the repo, just run the installation script locally. This will update your local ~/.git-support/seekret-rules directory with the changes in this repository.

./seekrets-install

You should now be able to run the check within any repository on your machine.

git seekret check -c 0 # check for secrets within commit history
git seekret check -s # check for secrets within staged files

Debugging

Your last Laptop run will be saved to ~/laptop.log. Read through it to see if you can debug the issue yourself. If not, copy and paste the entire log into a new GitHub Issue for us.

Git Seekrets False Positives

Sometimes the git-seekrets rules may indicate a false positive and match things that aren't actually secrets. This can happen if the regular expressions used to match and unmatch are too strict.

Make sure you have the latest rulesets from this repository by running the git-seekrets installation script.

If the ruleset is still triggering a false positive, please open an issue (or a pull request if you know how to fix the regular expression), and include the text that is being treated as a false positive, along with the rules installed on your computer. Please run this command to output your current rules, then copy and paste them into the GitHub issue:

cat ~/.git-support/seekret-rules/*.rule

What it sets up

  • ChromeDriver for headless website testing
  • chruby for managing Ruby versions
  • Cloud Foundry CLI for command line access to 18F's Cloud Foundry-based application platform
  • Docker for all your containerization needs
  • git-seekret for preventing you from committing passwords and other sensitive information to a git repository
  • [GitHub Desktop] for setting up your SSH keys automatically
  • Homebrew for managing operating system libraries
  • Homebrew Cask for quickly installing Mac apps from the command line
  • Homebrew Services so you can easily stop, start, and restart services
  • hub for interacting with the GitHub API
  • [nvm] for managing Node.js versions if you do not have Node.js already installed (Includes latest Node.js and NPM, for running apps and installing JavaScript packages)
  • pyenv for managing Python versions if you do not have Python already installed (includes the latest 3.x Python)
  • ruby-install for installing different versions of Ruby
  • Slack for communicating with your team
  • The Silver Searcher for finding things in files
  • Virtualenv for creating isolated Python environments (via pyenv if it is installed)
  • Virtualenvwrapper for extending Virtualenv (via pyenv if it is installed)
  • Zsh as your shell

It should take less than 15 minutes to install (depends on your machine and internet connection).

Customize in ~/.laptop.local and ~/Brewfile.local

Your ~/.laptop.local is run at the end of the mac script. Put your customizations there. If you want to install additional tools or Mac apps with Homebrew, add them to your ~/Brewfile.local. This repo already contains a .laptop.local and Brewfile.local you can use to get started.

# Go to your OS X user's root directory
cd ~

# Download the sample files to your computer
curl --remote-name https://raw.githubusercontent.com/18F/laptop/master/.laptop.local
curl --remote-name https://raw.githubusercontent.com/18F/laptop/master/Brewfile.local

It lets you install the following tools and apps:

  • VSCode - Microsoft's open source text editor
  • Atom - GitHub's open source text editor
  • Sublime Text 3 for coding all the things
  • Vim for those who prefer the command line
  • Exuberant Ctags for indexing files for vim tab completion
  • Firefox for testing your website on a browser other than Chrome
  • iTerm2 - an awesome replacement for the OS X Terminal
  • reattach-to-user-namespace to allow copy and paste from Tmux
  • Tmux for saving project state and switching between projects
  • Spectacle - automatic window manipulation

Write your customizations such that they can be run safely more than once. See the mac script for examples.

Laptop functions such as fancy_echo and gem_install_or_update can be used in your ~/.laptop.local.

What about background services (Redis, Postgres, MySQL, etc.)?

The script does not automatically install services like databases because you may not need any particular one, or you may need specific versions, not just the latest. For services, we recommend using Docker. For example, you can use the [docker run] command to start a service in a container and make the container's port available to your local machine:

docker run -p 5432 postgres:10.6

You can also use Docker Compose to define your app's containers and their relationships, cutting out the need to manually setup each service.

How to switch your shell back to bash from zsh (or vice versa)

  1. Find out which shell you're currently running: echo $SHELL

  2. Find out the location of the shell you want to switch to. For example, if you want to switch to bash, run which bash.

  3. Verify if the shell location is included in /etc/shells. Run cat /etc/shells to see the contents of the file.

  4. If the location of the shell is included, run chsh -s [the location of the shell]. For example, if which bash returned /bin/bash, you would run chsh -s /bin/bash.

    If the location of the shell is not in /etc/shells, add it, then run the chsh command. If you have Sublime Text, you can open the file by running subl /etc/shells.

  5. Quit and restart Terminal (or iTerm2), or open a new tab for the new shell to take effect.

Whether you're using bash or zsh, we recommend installing the latest versions with Homebrew because the versions that came with your Mac are really old.

brew install bash

or

brew install zsh

Credits

The 18F laptop script is based on and inspired by thoughtbot's laptop script.

Public domain

thoughtbot's original work remains covered under an MIT License.

18F's work on this project is in the worldwide public domain, as are contributions to our project. As stated in CONTRIBUTING:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

More Repositories

1

development-guide

A set of guidelines and best practices for an awesome software engineering team
HTML
1,159
star
2

analytics.usa.gov

The US federal government's web traffic.
SCSS
693
star
3

analytics-reporter

Lightweight analytics reporting and publishing tool for Google Analytics data.
JavaScript
616
star
4

technology-budgeting

See https://derisking-guide.18f.gov/
492
star
5

api-standards

API Standards for 18F
488
star
6

identity-idp

Login.gov Core App: Identity Provider (IdP)
Ruby
476
star
7

domain-scan

A lightweight pipeline, locally or in Lambda, for scanning things like HTTPS, third party service use, and web accessibility.
Python
371
star
8

checklistomania

Centrally managed todo lists for complex processes - onboarding, offboarding, management changes, etc.
JavaScript
364
star
9

accessibility

A repo to organize the guidelines and best practices for accessibility at 18f.
HTML
328
star
10

rdbms-subsetter

Generates a subset of a relational database that respects foreign key constraints
Python
317
star
11

open-source-guide

18F’s Style guide for open source project documentation
Ruby
290
star
12

18f.gsa.gov

This repository contains 18F's website.
HTML
289
star
13

methods

The methods 18F uses to practice human-centered design.
SCSS
220
star
14

jekyll-get

DEPRECATED - see https://github.com/brockfanning/jekyll-get-json instead
Ruby
212
star
15

open-data-maker

make it easy to turn a lot of potentially large csv files into easily accessible open data
Ruby
201
star
16

ads-bpa

A guide for the Agile Delivery Services BPA
Ruby
193
star
17

dolores-landingham-slack-bot

A Slack bot to welcome new 18F hires with the authority and compassion of Mrs. Landingham
Ruby
189
star
18

API-All-the-X

Resources and Materials for the /Developer Program
CSS
167
star
19

https

(Deprecated) https guidance for the 18F team
158
star
20

uswds-jekyll

A Jekyll theme showcasing the U.S. Web Design System
JavaScript
132
star
21

docker-compose-django-react

A strawman set up for using both Django and React in a new app
JavaScript
128
star
22

frontend

18F's Front End Guild –  content has been moved to https://github.com/18F/development-guide
Ruby
122
star
23

tock

We use Tock to track and report our time at 18F
Python
120
star
24

handbook

The home of policies and guidelines that make up TTS.
HTML
107
star
25

C2

an approval process automation tool
Ruby
104
star
26

fbopen

[DEPRECATED] An open API server, data import tools, and sample apps to help small businesses search for opportunities to work with the U.S. government.
JavaScript
101
star
27

pulse

How the federal .gov domain space is doing at best practices and policies.
CSS
94
star
28

standup-slack-bot

A Slack bot to streamline team standup without disturbing the overall flow of conversation
JavaScript
87
star
29

api.data.gov

A hosted, shared-service that provides an API key, analytics, and proxy solution for government web services.
HTML
84
star
30

content-guide

18F Content Guide
HTML
79
star
31

ux-guide

Resources, norms, and practices for doing user experience research and design work at 18F.
HTML
73
star
32

crime-data-explorer

Moved to https://github.com/fbi-cde
69
star
33

micropurchase

18F's micro-purchase threshold experiment management app.
Ruby
68
star
34

pages

DEPRECATED: Publishing platform for 18F sites a la GitHub pages
Ruby
63
star
35

transformation-research

Best practices in government digital transformation
60
star
36

doc_processing_toolkit

Python library to extract text from PDF, and default to OCR when text extraction fails.
Python
55
star
37

automated-testing-playbook

A set of principles, practices, idioms, and strategies pertaining to automated software testing and its adoption
Ruby
52
star
38

eligibility-rules-service

Researching an eligibility rules service - project documentation and task management
51
star
39

2015-foia

Please check out https://github.com/18F/foia-hub/issues to track our work. This repo is for project wide discussion, blogging, and scratch space for 18F's FOIA modernization team.
Python
50
star
40

guides-template

Jekyll template for 18F Guides, based on CFPB/DOCter
Ruby
49
star
41

us-federal-holidays

A Node.js package for getting US federal holidays for a given year, or determining if a date is a federal holiday.
JavaScript
47
star
42

2015-foia-hub

A consolidated FOIA request hub.
CSS
47
star
43

glossary

A glossary panel for your site to help readers understand jargon
JavaScript
46
star
44

agile

Agile Principles and Practice, documented by the 18F Agile Guild
HTML
46
star
45

lean-product-design

A guide to using Lean Product Design on your project
Ruby
46
star
46

hub

DEPRECATED: Documentation hub for the 18F team
JavaScript
46
star
47

web-design-standards-drupal

A Drupal base theme that uses the U.S. Web Design System. (ARCHIVED)
CSS
46
star
48

dashboard

DEPRECATED: A site to track our projects' status and much, much more...
JavaScript
44
star
49

autoapi

A basic spreadsheet to api engine
Python
43
star
50

eng-hiring

18F Engineering's guide to candidate selection, from resume screen to offer.
HTML
43
star
51

jekyll_pages_api

a Jekyll Plugin that generates a JSON file with data for all the Pages in your Site
Ruby
43
star
52

myusa

MyUSA was a single sign-on project for government, now deprecated. (More info: https://18f.gsa.gov/2015/05/18/myusa/)
Ruby
43
star
53

dns

DNS configuration for domains managed by GSA TTS
HCL
42
star
54

pdf-forms-tutorial

A step-by-step guide for programatically filling out PDF forms
Java
41
star
55

jekyll_pages_api_search

DEPRECATED - Jekyll search plugin based on lunr.js and jekyll_pages_api
Ruby
40
star
56

before-you-ship

merged into the TTS Handbook
Ruby
38
star
57

piipan

A privacy-preserving system for storing and matching de-identified Personal Identifiable Information (PII) records.
C#
37
star
58

stylelint-rules

A style (CSS, Sass) linter for the 18F style guide
JavaScript
36
star
59

joining-18f

A guide for anyone interested in joining the 18F team
CSS
36
star
60

charlie

18F's Slack bot, Charlie. Built on Bolt
JavaScript
35
star
61

identity-site

This is the Login.gov main website where the public is able to learn about their one account for government.
HTML
34
star
62

product-guide

A handbook for the 18F product team and to promote our product management best practices.
HTML
32
star
63

compliance-toolkit

Compliance at the speed of Delivery.
31
star
64

continua11y

continuous integration for website accessibility
JavaScript
31
star
65

ReVAL

ReVAL: Reusable Validation Library - A Django App for validating data via API and web interface
Python
31
star
66

fedramp-data

A repository for the data underlying the FedRamp Dashboard
JavaScript
31
star
67

emoji_search

A super simple commandline utility to search for slack messages that have been reacted to with a specific emoji
Python
31
star
68

slides

Slides for 18F - built automatically using Federalist
HTML
30
star
69

about_yml

.about.yml project metadata schema and tools
Ruby
30
star
70

identity-dev-docs

Login.gov developer documentation
HTML
29
star
71

raktabija

Bootstrap AWS account with Terraform and Go.CD
Python
29
star
72

confidential-survey

A Rails app for conducting confidential surveys without violating user privacy
Ruby
29
star
73

javascript-lessons

Beginning and Advanced lessons in javascript with a focus on functional programming. This repo contains both exercises and solutions. It is used by 18F to train its internal staff, but of course anyone is welcome to use it and possibly contribute.
JavaScript
29
star
74

jekyll_frontmatter_tests

A Jekyll plugin to test frontmatter on posts and other documents in a Jekyll site.
Ruby
28
star
75

data-federation-project

A project focused on tools and best practices to supported federated data collection efforts
28
star
76

tech-talks

Suggestions, schedules, and other information about the Engineering Chapter's Tech Talk meetings.
Jupyter Notebook
28
star
77

ifgovthenthat

If Gov Then That website, a project to promote gov open data by designing clever uses for government APIs. (Currently on hold.)
CSS
27
star
78

foia-recommendations

National FOIA Project: Research and Recommendations
HTML
27
star
79

brand

18F Brand
SCSS
26
star
80

onboarding-documents

Forms, emails, and checklists to help with onboarding
26
star
81

18f-scaffolding

A scaffold/generator to standardize 18F project setup
Shell
26
star
82

vulnerability-disclosure-policy

The vulnerability disclosure policy for 18F and GSA's Technology Transformation Service.
25
star
83

bpa-fedramp-dashboard

FedRAMP Dashboard BPA Order
25
star
84

culper

Culper is the foundation for eApp, a part of the National Background Investigation System (NBIS), supporting the SF-86, SF-85, and SF-85P. This is its source code and developer documentation. For background information and a demo video see https://github.com/18F/culper/wiki
JavaScript
25
star
85

code-of-conduct

18F's code of conduct.
24
star
86

scrapebox

A simple, system independent infrastructure for performing web scraping. Utilizes Vagrant virtualbox interface and puppet provisioning to create and execute scraping of web content to structured data quickly and easily without modifying your core system.
Python
24
star
87

identity-oidc-sinatra

Example OpenID Connect relying party as a Sinatra app
Ruby
23
star
88

identity-design-system

An extension of the U.S. Web Design System used on Login.gov sites to consistently identify the Login.gov brand.
SCSS
22
star
89

elasticsearch-rails-ha-gem

high availability extensions to the Elasticsearch::Rails standard tasks
Ruby
21
star
90

html-proofer-docker

HTML validation, made easy
Shell
21
star
91

fedramp-dashboard

JavaScript
21
star
92

tts-tech-portfolio

Home of the TTS Technology Portfolio team
JavaScript
21
star
93

linkify-citations

Turns legal citations in the DOM into links
HTML
20
star
94

ghad

GitHub administration command line tool
JavaScript
20
star
95

archived-guides

A collection of 18F guides.
HTML
20
star
96

Modular-Contracting-And-Agile-Development

Modular contracting and agile development resources.
CSS
20
star
97

data-act-pilot

This small DATA Act pilot contains code that translates agency data to a uniform DATA act format.
Python
20
star
98

shipper

Continuous deployment made easy and secure
Go
19
star
99

project-artifacts

Resources for running path analysis projects at 18F
19
star
100

urlsize

get the size of one or more URLs
JavaScript
19
star