Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicholas Duffy duffn

View GitHub Profile
@duffn
duffn / test-data-json.json
Last active Apr 26, 2020
Gatsby YAML Recipe Files
View test-data-json.json
[
{
"name": "Leia Organa",
"profession": "Princess"
},
{
"name": " Luke Skywalker",
"profession": "Jedi Knight"
},
{
@duffn
duffn / ecto_helper.ex
Created Jan 27, 2020
Ecto helper for error formatting
View ecto_helper.ex
# https://thebrainfiles.wearebrain.com/prettify-ecto-errors-b85e9a7977f6
defmodule EdgeBuilder.EctoHelper do
@moduledoc """
Provides helper functions
"""
@doc """
Prettifies changeset error messages.
By default `changeset.errors` returns errors as keyword list, where key is name of the field
@duffn
duffn / kubectl-version
Last active Dec 3, 2019
velero-deploy-debug-log
View kubectl-version
time="2019-12-03T17:45:40Z" level=info msg="setting log-level to DEBUG" logSource="pkg/cmd/server/server.go:171"
time="2019-12-03T17:45:40Z" level=info msg="Starting Velero server v1.2.0 (5d008491bbf681658d3e372da1a9d3a21ca4c03c)" logSource="pkg/cmd/server/server.go:173"
time="2019-12-03T17:45:40Z" level=info msg="No feature flags enabled" logSource="pkg/cmd/server/server.go:177"
time="2019-12-03T17:45:40Z" level=debug msg="starting plugin" args="[/velero run-plugins --log-level debug]" cmd=/velero logSource="pkg/plugin/clientmgmt/logrus_adapter.go:74" path=/velero
time="2019-12-03T17:45:40Z" level=debug msg="plugin started" cmd=/velero logSource="pkg/plugin/clientmgmt/logrus_adapter.go:74" path=/velero pid=16
time="2019-12-03T17:45:40Z" level=debug msg="waiting for RPC address" cmd=/velero logSource="pkg/plugin/clientmgmt/logrus_adapter.go:74" path=/velero
time="2019-12-03T17:45:40Z" level=debug msg="Setting log level to DEBUG" cmd=/velero logSource="pkg/plugin/framework/server.go:172" pluginName=velero
time
@duffn
duffn / github_prs.sh
Last active Dec 29, 2019
Get GitHub PRs from commits between two branches
View github_prs.sh
export STAGING=staging
export MASTER=master
export REPO=https://github.com/yourorg/yourrepo/pull/
git log --oneline $(git log -n 1 --pretty=format:"%H" $STAGING)...$(git log -n 1 --pretty=format:"%H" $MASTER) | grep -E '#[0-9]+' | gawk -v REPO="$REPO" 'match($0, /#([0-9]+)/, arr) {$1=""; print substr($0,2) "\t" REPO arr[1]}'
@duffn
duffn / periodTrigger.groovy
Created Jul 19, 2019
Update a Scan Repository Trigger in a Jenkins GitHub Cloudbees folder
View periodTrigger.groovy
// Update the PeriodicFolderTrigger of each job inside of a Cloudbees folder.
// Useful for updating individual repos as you cannot do this through the UI.
// https://stackoverflow.com/questions/57077851/jenkins-github-plugin-scan-organization-triggers
import com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger
import jenkins.model.Jenkins
import jenkins.branch.OrganizationFolder
println "Multibranch Items\n-------"
Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject.class).each { it.triggers
.findAll { k,v -> v instanceof com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger }
@duffn
duffn / dracula-refined.css
Created Mar 16, 2019
Dracula Theme for GitHub with Refined GitHub
View dracula-refined.css
.blob-code-inner {
font-family: 'Hack', Menlo, monospace;
font-size: 16px;
}
.blob-code-inner span.pl-k {
color: #FF79C6;
}
.blob-code-inner span.pl-c1,
@duffn
duffn / s3_public_bucket_policy.json
Last active Sep 8, 2018
S3 Public Bucket Policy
View s3_public_bucket_policy.json
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::example.com/*"]
}]
}
View keybase.md

Keybase proof

I hereby claim:

  • I am duffn on github.
  • I am duffn (https://keybase.io/duffn) on keybase.
  • I have a public key whose fingerprint is 8F29 B3DB 69FE 0961 A8E4 4AC5 3459 9F4A AC3B 4C9E

To claim this, I am signing this object:

@duffn
duffn / mysql_docker_buffalo.txt
Created Aug 31, 2018
MySQL in Docker with Buffalo
View mysql_docker_buffalo.txt
# MySQL in Docker
docker run --name=mysql01 -p 3306:3306 mysql/mysql-server:latest
docker exec -it mysql01 mysql -uroot -p
# Enter the one time password generated from the docker run command
# and then change the root password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypassword';
# Create a user with your host IP address so it can connect from Buffalo
# outside the container
create user 'root'@'172.17.0.1' with password 'mypassword';
GRANT ALL PRIVILEGES ON * . * TO 'root'@'172.17.0.1';
@duffn
duffn / greleaser_basic.sh
Created Aug 19, 2018
greleaser_basic.sh
View greleaser_basic.sh
greleaser -p 10003 -v 10001 -g my-github-project
You can’t perform that action at this time.