Skip to content

Instantly share code, notes, and snippets.

View farrellit's full-sized avatar

Dan Farrell farrellit

View GitHub Profile
@yinzara
yinzara / github_bitbucket_multiple_ssh_keys.md
Last active April 19, 2024 00:22
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@ayubmalik
ayubmalik / gpg-encrypt.go
Last active March 3, 2023 08:49
Golang encrypt file using GPG openpgp. Use standard go libs.
package main
/**
Example hack to encrypt a file using a GPG encryption key. Works with GPG v2.x.
The encrypted file e.g. /tmp/data.txt.gpg can then be decrypted using the standard command
gpg /tmp/data.txt.gpg
Assumes you have **created** an encryption key and exported armored version.
You have to read the armored key directly as Go cannot read pubring.kbx (yet).
@felixgr
felixgr / hidnative.c
Created May 27, 2017 07:37
Remove Caps Delay MBP15 Touchbar Late 2016
// Build:
// clang hidnative.c -o hidnative -framework IOKit -framework CoreFoundation
//
// Run:
// sudo ./hidnative
#include <IOKit/hid/IOHIDManager.h>
#include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/IOKitLib.h>
#include <CoreFoundation/CoreFoundation.h>
@bcatubig
bcatubig / ssh.sh
Last active June 12, 2020 03:25
Passwordless SSH Function - inject your ssh key into a server without actually typing your password in; lastpass does that for you!
# Works with Bash and ZSH
# Copy this into your ~/.bashrc or ~/.zshrc
# Install Lastpass cli -- https://github.com/lastpass/lastpass-cli
# Install sshpass
# OSX: $ brew install http://git.io/sshpass.rb
# Be sure to change <MYLASTPASS-PASSWORD-ID> in the install_keys() function
function install_keys (){
echo "INFO: No SSH Key on server. Grabbing password from lastpass"
export SSHPASS=$(lpass show <MYLASTPASS-PASSWORD-ID> --password)
/usr/local/bin/sshpass -e ssh-copy-id $1 || return 255
@sivel
sivel / go-build.sh
Last active September 28, 2023 18:40
Ansible Binary Golang Module
go build helloworld.go
GOOS=windows GOARCH=amd64 go build helloworld.go
@stephen-mw
stephen-mw / list_ec2_instances.md
Last active April 18, 2022 16:07
List running EC2 instances with golang and aws-sdk-go

This is the beginning of hopefully many new posts with golang snippets from my blog. List all of your running (or pending) EC2 instances with Amazon's golang sdk.

For a list of filters or instance attributes consult the official documentation.

package main

import (
	"fmt"
	"github.com/awslabs/aws-sdk-go/aws"
@stuart-warren
stuart-warren / simple-gpg-enc.go
Last active October 11, 2023 01:21
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@michaljemala
michaljemala / tls-client.go
Last active April 10, 2024 01:57
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@kgrz
kgrz / sinatra_regex_routing_one.rb
Last active July 3, 2017 18:37
Sinatra's regex routing and captures block example
require "sinatra"
get %r{/([\w]+)/foo} do |bar|
puts bar
end
@angstwad
angstwad / test_split_jinja_ansible.yml
Created March 31, 2014 14:24
Splitting in Jinja2/Ansible
---
- name: Test split
hosts: localhost
gather_facts: false
vars:
- facter_blockdevices: "sda,sdb,sdc,sdd,sde,sdf"
tasks:
- name: Let's split
debug: var=item
with_items: "facter_blockdevices.split(',')"