Skip to content

Instantly share code, notes, and snippets.

View richardbowden's full-sized avatar

Richard Bowden richardbowden

  • Western Australia
View GitHub Profile
@richardbowden
richardbowden / urfave_cli_choices_ext.go
Created November 26, 2022 12:34
urfave_cli_choices_ext
type CLIChoice struct {
Choices []string
Default string
chosen string
}
func (c *CLIChoice) Set(value string) error {
for _, choice := range c.Choices {
if choice == value {
c.chosen = value
call plug#begin('~/.local/share/nvim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'majutsushi/tagbar'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'universal-ctags/ctags'
Plug 'tweekmonster/startuptime.vim'
Plug 'tpope/vim-commentary'

Keybase proof

I hereby claim:

  • I am richardbowden on github.
  • I am richardbowden (https://keybase.io/richardbowden) on keybase.
  • I have a public key whose fingerprint is 79B5 95B1 8FCD 799D 2907 782B 289E 0962 8EE7 D9A6

To claim this, I am signing this object:

#include <stdio.h>
#include <string.h>
int main()
{
char *string = "hello, world!";
size_t len = strlen(string);
int divide;
@richardbowden
richardbowden / iams3lockdown.json
Created February 11, 2015 10:02
lock down an s3 bucket to IAM user example
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1412062044000",
"Effect": "Allow",
"Action": [
"s3:AbortMultipartUpload",
"s3:GetBucketAcl",
"s3:GetBucketLocation",
@richardbowden
richardbowden / date_tools.py
Last active August 29, 2015 14:14
get years and months from two dates
from datetime import datetime
def get_length_of_time(start_date, end_date=None, days_in_year=365, days_in_month=30):
"""
start_date and end_date should be a datetime object with the day of month
always being 1, as all we need is to calc years and months between two dates
"""
if end_date == None:
d = date.today()
end_date = datetime(d.year, d.month, 1)