Skip to content

Instantly share code, notes, and snippets.

@tekin
tekin / .gitattributes
Last active February 23, 2024 16:46
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
@xirkus
xirkus / yubikey+gpupgp+ssh_howto.md
Last active March 10, 2024 13:17
Security Adventures 1. How to get yubikey+gpg+ssh+gitbhub working on MacOS

I've spent the day trying to get this setup working with GitHub and given the number of gotcha's I encountered, it seemed like a good idea to document how I finally got this working with as few hacks as possible. There's a lot of documentation out there (some of it old and misleading) and committing here for posterity will help me remember this when I inevitably need to do this again.

Rationale

Passwords are simply not enough these days. Regardless of the company, breaches (and the associated Personally Identifiable Information harvested) are a matter of not if, but when. There are a number of things you can do to protect yourself, but being on the tin-foil-hat side of paranoia, means there are a few Commandents that I adhere to (and recommend for other folks)[Insert link to Fight Club Rules for the Secure Internet].

That being said, if you use 2-factor authentication and have committed to using a hardware token such as the Yubikey, then you're already ahead of the curve. The problem is that wh

@rams3sh
rams3sh / aws_regex_cheat_sheet
Last active February 28, 2024 14:06
Common AWS Related Regex (AWS)
ARN Base Pattern :-
arn:<aws_parition>:<aws_service>:[<aws_region>]:<account_id>:<root | resource_type>:/<resource_name>[/<sub_resource_names>...]
i. <aws_partition>
Regex - (aws|aws-us-gov|aws-cn)
ii. <aws_service> - No fixed pattern
iii. <aws_region> - No fixed pattern
Most of the regions occur in combination of 2 letter followed by "-" followed by a combination of direction based word , followed by a "-" and then a digit.
@artizirk
artizirk / gnupg_scdaemon.md
Last active April 3, 2024 14:49
OpenPGP SSH access with Yubikey and GnuPG

NB: This document describles a 'Old-School' way of using Yubikey with SSH

Modern OpenSSH has native support for FIDO Authentication. Its much simpler and should also be more stable with less moving parts. OpenSSH also now has support for signing arbitary files witch can be used as replacement of gnupg. Git also supports signing commits/tags with ssh keys.

Pros of FIDO

  • Simpler stack / less moving parts
  • Works directly with ssh, ssh-add and ssh-keygen on most computers
  • Simpler
  • Private key can never leave the FIDO device

Cons of FIDO

@justinsoliz
justinsoliz / resources.tf
Created August 30, 2016 15:26
Terraform S3 to Lambda notification
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
resource "aws_iam_role" "iam_for_terraform_lambda" {
name = "app_${var.app_env}_lambda"
assume_role_policy = <<EOF
{
@rhaseven7h
rhaseven7h / PS1.sh
Created July 28, 2016 08:23
PS1 Setup with nvm and git branch
export PS1="┏ \[$(tput bold)\]\[$(tput setaf 2)\]\u\[$(tput setaf 7)\]\[$(tput bold)\]@\[$(tput setaf 6)\]\H \[$(tput setaf 3)\][\w]\[$(tput sgr0)\]\n┃ \[$(tput bold)\]\[$(tput setaf 7)\]\d :: \t :: nvm=\$(nvm current) :: branch=\$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo not-a-git-repo) :: Cmd #\!\[$(tput sgr0)\] \n┗ \[$(tput bold)\]\[$(tput setaf 3)\]\\$ \[$(tput sgr0)\]\[$(tput sgr0)\]"
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@webandtech
webandtech / cf.rake
Last active December 18, 2015 19:48
Rake task for deploying a git repo to Cloud Foundry. Based on https://gist.github.com/jamiew/4429547
require 'fileutils'
namespace :cf do
desc 'Deploy to staging on Cloud Foundry'
task :deploy_staging do
cf_target = 'api.run.pivotal.io'
deploy_branch = 'master'
deploy_space = 'staging'
deploy_org = "YOUR ORGANIZATION"
deploy_repo_dir = "tmp/cf_deploy"
@jacquescrocker
jacquescrocker / Gemfile
Created October 16, 2012 10:13
Gemfile for DeployButton.com
# deploybtn Gemfile
source 'https://rubygems.org'
gem "rake", ">= 0.9.2"
gem 'rails', ">= 3.2.7"
gem 'json'
gem "rails_config", "0.2.5"
gem "guid"
@rubiojr
rubiojr / rbvmomi_example1.rb
Created September 5, 2011 15:28
Ruby VMWare VSphere API Example 1 (rbvmomi)
require 'rubygems'
require 'rbvmomi'
require 'pp'
require 'alchemist'
hyper = 'thunder03'
vim = RbVmomi::VIM.connect :host => hyper, :user => 'root', :password => 'secret', :insecure => true
#
# get current time