Skip to content

Instantly share code, notes, and snippets.

View davidclin's full-sized avatar

David Lin davidclin

  • Santa Clara, CA
View GitHub Profile
@davidclin
davidclin / generate-ssh-key.sh
Created August 5, 2020 17:14 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@davidclin
davidclin / amifind.sh
Created May 6, 2020 06:57 — forked from vancluever/amifind.sh
Find the most recent Ubuntu AMI using aws-cli (or any other AMI for that matter)
#!/bin/sh
# Use AWS CLI to get the most recent version of an AMI that
# matches certain criteria. Has obvious uses. Made possible via
# --query, --output text, and the fact that RFC3339 datetime
# fields are easily sortable.
export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-images \
@davidclin
davidclin / README.md
Created July 9, 2019 18:38 — forked from joyrexus/README.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@davidclin
davidclin / GitHub-Forking.md
Created June 13, 2019 23:16 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@davidclin
davidclin / all_aws_managed_policies.json
Created April 26, 2019 19:39 — forked from gene1wood/all_aws_managed_policies.json
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
{
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 1,
"CreateDate": "2018-08-10T17:57:44+00:00",
"DefaultVersionId": "v3",
"Document": {
"Statement": [
{
"Action": [
@davidclin
davidclin / multiple-git-hooks.sh
Created October 31, 2018 05:28 — forked from mjackson/multiple-git-hooks.sh
Run multiple scripts for the same git hook
#!/bin/sh
# This script should be saved in a git repo as a hook file, e.g. .git/hooks/pre-receive.
# It looks for scripts in the .git/hooks/pre-receive.d directory and executes them in order,
# passing along stdin. If any script exits with a non-zero status, this script exits.
script_dir=$(dirname $0)
hook_name=$(basename $0)
hook_dir="$script_dir/$hook_name.d"
@davidclin
davidclin / gist:82186d4d2065e859160a72a64e7e067d
Created June 8, 2018 08:47 — forked from sebsto/gist:468670c7c0d5feeade69
AWS CLI : discover your service limits from the command line
aws support describe-trusted-advisor-check-result --check-id eW7HH0l7J9 --query 'result.sort_by(flaggedResources[?status!="ok"],&metadata[2])[].metadata' --output table --region us-east-1
@davidclin
davidclin / Ansible-Vault how-to.md
Created October 10, 2017 20:00 — forked from tristanfisher/Ansible-Vault how-to.md
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

##Working with ansible-vault

I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@davidclin
davidclin / git_newrepo
Created October 9, 2017 23:23 — forked from c0ldlimit/git_newrepo
Git: Push a new or existing repo to Github
# Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/c0ldlimit/vimcolors.git
git push -u origin master
# Push an existing repository from the command line
@davidclin
davidclin / gist:cbb3a7af9bedf8f39c2961e898e6a707
Created September 29, 2017 21:39
Basic install of Ansible using EC2 Amazon Linux AMI (Free tier)
==========================
Last Validated: 09/29/2017
==========================
ssh to your ec2 amazon ec2 instance
# Update and install dependencies
sudo su
yum update
yum install -y git