Skip to content

Instantly share code, notes, and snippets.

@DCRichards
DCRichards / git-setup.md
Last active July 5, 2022 22:35
Git setup

Git installation

In order to use Git, you need to make sure it's available on your platform. Follow the instructions below to make sure you're set up.

Mac

Luckily, Git comes with Mac by default, but you might need to enable it.

  1. Open your terminal. If you've never done this before you can find it in Applications > Utilities > Terminal.
  2. Type git --version and press enter.
#!/bin/sh
set -e
eval "$(ssh-agent)"
ssh-add /root/.ssh/id_rsa
exec "$@"
git ls-remote [email protected]:you/greatlib.git
pipeline:
test:
image: golang:1.9-alpine
pull: true
commands:
- apk --update add git openssh
- go get -u github.com/golang/dep/cmd/dep
- cp -R ssh /root/.ssh
# We need this or we'll be warned about our private key security.
- chmod 0400 /root/.ssh/id_rsa
FROM golang:1.9
# (other stuff omitted for brevity)
# Add your keys to the container
COPY ssh /root/.ssh
# Start the SSH Agent, add the SSH Key and then ensure our dependencies
RUN eval "$(ssh-agent)" && ssh-add /root/.ssh/id_rsa && dep ensure
@DCRichards
DCRichards / ssh-keygen.sh
Created March 28, 2018 13:42
Generate SSH key
ssh-keygen -t rsa -b 4096 -C "user@host or just a comment"
@DCRichards
DCRichards / add-ssh.sh
Created March 28, 2018 13:39
Adding an SSH key
cp id_rsa_mylib ~/.ssh
cp id_rsa_mylib.pub ~/.ssh
ssh-add ~/.ssh/id_rsa_mylib
@DCRichards
DCRichards / main.go
Created February 16, 2018 13:05
Golang profiling 1
package main
import (
"log"
"net/http"
pp "net/http/pprof"
"time"
)
func main() {
@DCRichards
DCRichards / branchFromIssue.js
Created August 30, 2016 21:23
Create a git branch from a GitHub issue
javascript: (function(){var e=prompt("Enter the prefix for your branch (eg. bug, feature)","feature")||"feature",t=document.getElementsByClassName("js-issue-title")[0].innerText||"my-new-feature";t=t.replace(/\s/g,"-"),t=t.replace(/[^a-zA-Z0-9-]/g,""),t=t.toLowerCase();var r=e+"/"+t;alert("git push origin dev:"+r+" && git checkout -t origin/"+r)}());
@DCRichards
DCRichards / Dog.java
Last active August 29, 2015 14:16
A simple dog class
public class Dog {
String name;
public Dog(String name) {
this.name = name;
System.out.println("Hello, I'm " + name);
}
public void bark() {