Skip to content

Instantly share code, notes, and snippets.

Avatar

Evan Kaufman EvanK

  • Washington, USA
View GitHub Profile
@EvanK
EvanK / docs-generation.md
Last active Feb 29, 2020
Generating static docs for caps-api - like pushing a boulder uphill
View docs-generation.md

Available tooling

Unfortunately, most useful tools for generating static documentation from a swagger spec are no longer maintained or only support swagger's 2.0 format -- we are using the 3.0 format.

The only tool I could find was swagger-codegen, which is built in and requires dependencies in (gag) Java.

Static html

Codegen allows us to generate a single-page static document:

View auth_openidc_vhost.apacheconf
# configuring our local server for auth via Google
OIDCRedirectURI /example/redirect_uri
OIDCCryptoPassphrase some-big-fancy-secret-passphrase
OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration
# ensure the provider (Google in this case) gives us the user email
OIDCScope "openid email"
# credentials from the Google API console
OIDCClientID 123456789012-somelonghashedid.apps.googleusercontent.com
View gist:6d43cb9fa7b9d704d767
### Keybase proof
I hereby claim:
* I am evank on github.
* I am evanskaufman (https://keybase.io/evanskaufman) on keybase.
* I have a public key whose fingerprint is A841 C275 E509 6657 3814 0689 6508 E211 586F 8E5A
To claim this, I am signing this object:
@EvanK
EvanK / cap2.sh
Created May 27, 2014
Deploying specific branch/committish in Capistrano 2 vs 3
View cap2.sh
# -S key=value
cap staging deploy -S branch=42-super-awesome-feature-branch
@EvanK
EvanK / nope.xml
Created Nov 19, 2013
Pro tip: PHPUnit's test suite "exclude" nodes don't do wildcard expansion. Took me longer than I'd like to admit figuring this out.
View nope.xml
<phpunit>
<testsuites>
<testsuite name="Unit">
<directory>../src/*/Bundle/*Bundle/Tests</directory>
<exclude>src/*/Bundle/*Bundle/Tests/Functional</exclude>
</testsuite>
</phpunit>
@EvanK
EvanK / .gitconfig
Created Oct 23, 2013
If you don't have a `.gitconfig` file in your home directory, create it: touch ~/.gitconfig
View .gitconfig
[user]
email = you@yourprovider.com
name = The name you want showing up in commits
[core]
editor = vi
[push]
default = current
@EvanK
EvanK / file-basename.pl
Created Apr 22, 2011
Perl `basename` and `dirname` module-free implementations
View file-basename.pl
# WHY would we need this? For a situation where loading File::Basename isn't possible
# For example, in a BEGIN block, to tinker with @INC.
sub basename {
my $file = shift;
$file =~ s!^(?:.*/)?(.+?)(?:\.[^.]*)?$!$1!;
return $file;
}
sub dirname {
@EvanK
EvanK / gist:908834
Created Apr 7, 2011
Remove a deleted branch from a remote
View gist:908834
# remove the branch "branch-name" from the remote "origin"
git push origin :branch-name
@EvanK
EvanK / working_dir.sh
Created Feb 2, 2011
dirname(realpath($SOMEPATH)) in bash
View working_dir.sh
#!/bin/sh
# 1. takes $0 (the currently running script)
# 2. puts it through `readlink -f` to resolve any symlinks
# 3. puts it through `dirname` to remove the filename
working_dir=$(dirname $(readlink -f $0))
# so if i symlink a script from /home/ekaufman/myinit.sh to /etc/init.d/mything then even if I
# execute /etc/init.d/mything, ${working_dir} will be "/home/ekaufman"
@EvanK
EvanK / gist:793440
Created Jan 24, 2011
Remove pre-installed Facebook & Twitter apps from Android
View gist:793440
$ adb shell
# su
# busybox mount -o rw,remount /system
# rm /system/app/Facebook.apk
# pm uninstall com.facebook.katana
Success
# rm /system/app/Twitter.apk
# pm uninstall com.twitter.android
Success
# exit