Skip to content

Instantly share code, notes, and snippets.

View corsc's full-sized avatar
🏠
Working from home

Corey Scott corsc

🏠
Working from home
View GitHub Profile
@corsc
corsc / API Error (by endpoint)
Last active May 20, 2021 04:44
Companion Code to an article of Dashboarding metrics
{
"viz": "timeseries",
"requests": [
{
"q": "sum:astria.astria.api.count{$commit,$host,$environment,!respcode:200,!respcode:402,!respcode:422,!respcode:403} by {endpoint,respcode}.as_count()",
"type": "bars",
"style": {
"palette": "dog_classic",
"type": "solid",
"width": "normal"
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\u@\h:\w\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"
benchmark iterations time/iteration delta delta%
--------- ---------- -------------- ----- ------
BenchmarkV1 50000 380653 ns/op
BenchmarkV2 100000 355788 ns/op -24865 -6.5%
BenchmarkV3 100000 357934 ns/op -22719 -5.9%
@corsc
corsc / ae
Last active April 11, 2016 23:10
IntelliJ Live Templates for Go
assert.Equal(t, $END$, )
@corsc
corsc / ex01_bad
Last active February 1, 2016 07:20
func do(a int, b int) int {
return a + b
}
@corsc
corsc / after.go
Last active August 29, 2015 14:10
Golang Revenge of Capt Obvious
amount := 12.34
ID := int64(3)
@corsc
corsc / Define the type
Created September 17, 2014 15:00
Example of Enums in Go
// Color is a custom type (enum) to improve my code readibility
type Color int64
@corsc
corsc / clean.sh
Created September 14, 2014 04:16
Sample Golang cleanup & check script
#!/bin/bash
# ======================
# Download the tools
# ======================
go get code.google.com/p/go.tools/cmd/goimports
go get github.com/golang/lint/golint
# ======================
# Clean the Code
@corsc
corsc / App dir build.gradle
Last active December 28, 2015 19:09
Companion Files to Blog post http://wp.me/p3GNDA-3Q
// Project properties
project.group = 'org.sage42.sample'
project.version = '1.0.0'
// standard android plugin
apply plugin: 'android'
// plugin with signing (aka deploying) APKs
apply plugin: 'signing'
@corsc
corsc / ClickMe
Last active December 28, 2015 19:09
Simple Robotium Sanity Test
/**
* Verify that clicking the button shows a toast with "Ouch"
*/
public void testOnClickMe()
{
final Solo solo = this.getSolo();
// click the button
solo.clickOnButton(this.getContext().getString(R.string.main_click_me));