Skip to content

Instantly share code, notes, and snippets.

Avatar
🎩

Gene Wood gene1wood

🎩
View GitHub Profile
@gene1wood
gene1wood / chef-stacktrace.out
Created Jun 27, 2022
Chef stacktrace showing bug in Chef snap_package resource
View chef-stacktrace.out
Generated at 2022-06-26 22:26:03 -0700
ArgumentError: snap_package[plex-htpc] (wendy::packages line 321) had an error: ArgumentError: wrong number of arguments (given 1, expected 2)
/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.3/lib/chef/provider/package/snap.rb:266:in `install_snaps'
/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.3/lib/chef/provider/package/snap.rb:69:in `install_package'
/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.3/lib/chef/provider/package.rb:120:in `block (3 levels) in <class:Package>'
/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.3/lib/chef/provider/package.rb:267:in `multipackage_api_adapter'
/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.3/lib/chef/provider/package.rb:119:in `block (2 levels) in <class:Package>'
/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.3/lib/chef/mixin/why_run.rb:51:in `add_action'
/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.3/lib/chef/provider.rb:293:in `converge_by'
/opt/chef/embedded/lib/ruby/ge
@gene1wood
gene1wood / _Portable-DHCP-Server.md
Last active Jun 26, 2022
Portable docker based DHCP server
View _Portable-DHCP-Server.md

This is an easy method to spawn a portable DHCP server. It uses the https://github.com/networkboot/docker-dhcpd docker container.

  1. mkdir data
  2. wget -O data/dhcpd.conf https://gist.githubusercontent.com/gene1wood/381582ec03d63b0b4770ed831de8e667/raw/cd2b61c64e04934ec41c38b7a3cc53ead48aea5c/dhcpd.conf
  3. INTERFACE=eth0
  4. docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd $INTERFACE
@gene1wood
gene1wood / alameda-to-mozilla-and-back.md
Last active Jun 3, 2022
Alameda to Mozilla and back via the ferry
View alameda-to-mozilla-and-back.md

To work by MC

Home - MC Depart Alameda Seaplane Arrive Downtown S.F. Arrive Mozilla Target Departure
6:16 AM 6:30 AM 6:50 AM 6:58 AM 3:20 PM to Ferry Gate F (9:02)
6:46 AM 7:00 AM 7:20 AM 7:28 AM 3:20 PM to Ferry Gate F (8:32)
7:11 AM 7:25 AM 7:45 AM 7:53 AM 3:20 PM to Ferry Gate F (8:07)
8:06 AM 8:20 AM 8:40 AM 8:48 AM 4:20 PM to Ferry Gate F (8:12)
9:01 AM 9:15 AM 9:35 AM 9:43 AM 5:20 PM to Ferry Gate F (8:17)

To work by bus + ferry

@gene1wood
gene1wood / update-repo.sh
Created Sep 27, 2021
Update a local git repo by switching to master, fetching all remotes, deleting all local branches that track a remote branch that's now gone, fast forward merge upstream into local master and push local master to origin
View update-repo.sh
#!/bin/bash -e
# https://gist.github.com/gene1wood/ddd66d79fc472f351a04c643aecbcf75
log() {
echo -e "\e[92m${1}\e[0m"
}
if ! git status >/dev/null 2>&1; then
log "Must be in a git repo"
@gene1wood
gene1wood / thread-on-how-maintainers-assert-their-role.md
Created Sep 17, 2021
Here's a thread I've started with the Mozilla GitHub owners to try to agree on a standard for how maintainers assert their role
View thread-on-how-maintainers-assert-their-role.md

With the recent Travis CI security issue, it's again become necessary for Mozilla security folks to need to be able to contact maintainers of our GitHub repos (in this case to coordinate rotation of leaked credentials). I wanted to see if we (GitHub owners) could come up with a standard (either an existing one or make one) for how people can assert and communicate their role as a maintainer of a given GitHub repo. I don't know if an email thread is the best channel, but I thought I'd start this and we could switch to a zoom call if folks want. Here are some potential solutions that have come to mind

SECURITY.md

This standard ( https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository ) is so repo maintainers can assert how to report security vulnerabilities.

  • It's public so maintainers might be reluctant to put email addresses in there
@gene1wood
gene1wood / duplicacy_github_issues_disabled_earlier_this_year.md
Last active Sep 12, 2021
Duplicacy GitHub issues disabled earlier this year
View duplicacy_github_issues_disabled_earlier_this_year.md

It looks like GitHub issues were disabled on the Duplicacy GitHub repo sometime between April and July this year (2021). I noticed this while checking back on a bug to see if I still needed to continue to use a workaround or if it had been fixed.

I searched through the repo README, on the duplicacy.com website and here in the forums but don't see any mention of the disabling of issues, or where one is meant to report or track bugs now.

Gilbert, if the intent is to prevent opening new issues (I'm guessing here, but as a maintainer of open source software I'm familiar with the challenges of getting low quality issues), would it be possible to, instead of disabling GitHub issues, re-enable GitHub issues and instead create a [6 month interac

@gene1wood
gene1wood / person_api.sh
Created May 11, 2021
Tool I source to get some query functions for CIS Person API
View person_api.sh
export person_api_client_id=xxx
export person_api_client_secret=xxx
export audience=api.sso.mozilla.com
export api_domain=person.api.sso.mozilla.com
if [ -z "$person_api_bearer_token" ]; then
echo "Fetching bearer token"
export person_api_bearer_token=$(curl \
--silent \
--request POST \
@gene1wood
gene1wood / delete_all_s3_bucket_files
Created Apr 29, 2021
Command to delete all objects from S3 bucket using lifecycle configuration
View delete_all_s3_bucket_files
for bucket in `cat list-of-s3-buckets.txt`; do
aws s3api put-bucket-lifecycle \
--bucket $bucket \
--lifecycle-configuration '{"Rules":[{"ID":"cleanup","Status":"Enabled","Prefix":"","Expiration":{"Days":1}}]}';
done
@gene1wood
gene1wood / peertube-cannot-retrieve-oauth-client-credentials-undefined-clien-invalid-fix.md
Created Feb 26, 2021
Fix for the peertube error "Cannot retrieve OAuth Client credentials: undefined" and "client invalid"
View peertube-cannot-retrieve-oauth-client-credentials-undefined-clien-invalid-fix.md

I deployed Peertube via Docker but did not use the included nginx docker container and instead put Peertube behind an Apache httpd reverse proxy.

I was getting the error : Cannot retrieve OAuth Client credentials: undefined when loading the peertube page and the error client invalid when attempting to log in.

The cause was that I wasn't passing the host header through Apache because I was missing the ProxyPreserveHost On directive.

I added this and resolved the issue

@gene1wood
gene1wood / bugzillarc-for-use-at-Mozilla
Created Feb 24, 2021
The ~/.config/python-bugzilla/bugzillarc file to use for bugzilla.mozilla.org
View bugzillarc-for-use-at-Mozilla
[DEFAULT]
url = https://bugzilla.mozilla.org/xmlrpc.cgi
[bugzilla.mozilla.org]
api_key = xxxxxxxxxxxxxxx