Skip to content

Instantly share code, notes, and snippets.

View robert-claypool's full-sized avatar
💥
Breaking Things

Robert Claypool robert-claypool

💥
Breaking Things
View GitHub Profile
@robert-claypool
robert-claypool / gist:3d6ca2af08679bb3a3cb
Created August 7, 2014 19:56
onename.io Identity Verification
Verifying myself: My Bitcoin username is +robert_claypool. https://onename.io/robert_claypool
@robert-claypool
robert-claypool / domain-user-as-sysadmin.sql
Created August 22, 2014 21:22
How to Add a Windows Domain User to SQL Server as ‘sysadmin’
USE master
GO
CREATE LOGIN [domain\username] FROM WINDOWS WITH DEFAULT_DATABASE = [Master]
GO
EXEC sp_addsrvrolemember @loginame=N'domain\username', @rolename=N'sysadmin'
GO
@robert-claypool
robert-claypool / p4merge-git-config
Last active August 29, 2015 14:22
A typical P4Merge Git configuration
git config --global mergetool.p4merge.path 'c:\path-to\p4merge.exe'
git config --global merge.tool p4merge
git config --global difftool.p4merge.path 'c:\path-to\p4merge.exe'
git config --global diff.tool p4merge
@robert-claypool
robert-claypool / ssh-keys-management-advice
Last active August 29, 2015 14:23
SSH keys management advice
Use separate private keys *per origin* (e.g. one from your work computer and a separate one for your personal laptop).
The same is not true of destinations: One private key on your personal laptop can serve to access multiple destinations;
if that key is compromised, all other private keys stored on in the same directory will surely be compromised as well.
-- http://superuser.com/a/189485/13481
@robert-claypool
robert-claypool / putty-ssh-to-amazon-linux.md
Created August 3, 2015 04:55
Troubleshooting PuTTY SSH to an Amazon Linux instance in a VPC

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html#TroubleshootingInstancesConnectingPuTTY

  • Check the instance security group rules. Allow incoming SSH, port 22.
  • Are DNS resolution & hostnames enabled for the VPC?
  • Does the VPC have an Internet gateway?
  • Check the route table for the VPC subnet. Add 0.0.0.0/0 --> Internet gateway
  • Check the network access control list (ACL) for the subnet. Allow incoming SSH, port 22.
  • Use the right private key, duh. Look it up under the instance details, https://console.aws.amazon.com/ec2/v2/home

Login as the right user:

@robert-claypool
robert-claypool / us-states-and-territoties.csv
Created November 11, 2015 19:47
States and Territories of the United States
ID State_FIPS State_Name State_Postal
0 08 Colorado CO
1 48 Texas TX
2 31 Nebraska NE
3 56 Wyoming WY
4 06 California CA
5 04 Arizona AZ
6 32 Nevada NV
7 27 Minnesota MN
8 28 Mississippi MS
@robert-claypool
robert-claypool / web.config
Created November 13, 2015 03:28
IIS configuration for HTTP to HTTPS redirects behind an AWS Electric Load Balancer; IIS URL Rewrite must be installed.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTPS rewrite behind AWS Electric Load Balancer rule" enabled="true" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" />
</conditions>
@robert-claypool
robert-claypool / standard-paths.md
Created November 18, 2015 05:18
Unix/Linux Standard Filesystem Paths

Basically (and very roughly), the standard paths on Unix are:

  • /bin & /sbin for vital programs for the OS, sbin being for administrators only ;
  • /usr/bin & /usr/sbin for not vital programs, sbin being for administrators only ;
  • /var for living data for programs. It can be cache data, spool data, temporary data (unless it's in /tmp, which is wiped at every reboot), etc. ;
  • /usr/local for locally installed programs. Typically, it hosts programs that follow the standards but were not packaged for the OS, but rather installed manually by the administrator (using for example ./configure && make && make install) as well as administrator scripts ;
  • /opt for programs that are not packaged and don't follow the standards. You'd just put all the libraries there together with the program. It's often a quick & dirty solution, but it can also be used for programs that are made by yourself and for which you wish to have a specific pa
@robert-claypool
robert-claypool / aws-signed-url-generator.sh
Last active November 20, 2015 07:52
This script prints a signed URL for HTTP GET'ting a file from AWS CloudFront
#!/bin/bash
#================================================================
# HEADER
#================================================================
#% SYNOPSIS
#+ ${script_name} [-h] [-o[file]] input_date path
#%
#% DESCRIPTION
#% This script prints a signed URL for HTTP GET'ting a file
#% from AWS CloudFront https://sendr.example.com
@robert-claypool
robert-claypool / ag-vim-notes.md
Last active January 14, 2016 20:44
Notes on Ag for Vim

Notes on ag.vim

This plugin is a front for ag, A.K.A. the_silver_searcher, https://github.com/rking/ag.vim

Usage: ag [FILE-TYPE] [OPTIONS] PATTERN [PATH]

Ag searches from your current working directory if a PATH is not given.

  • Check your working directory in Vim with :pwd
  • Change your working directory with :cd [PATH]