Skip to content

Instantly share code, notes, and snippets.

View danesparza's full-sized avatar
:octocat:
The best way to predict the future is to invent it - Alan Kay

Dan Esparza danesparza

:octocat:
The best way to predict the future is to invent it - Alan Kay
View GitHub Profile
@danesparza
danesparza / main.go
Created August 30, 2018 18:09
Simple laydon test
package main
import (
"log"
. "github.com/ory/ladon"
manager "github.com/ory/ladon/manager/memory"
)
func main() {
@danesparza
danesparza / main.go
Created August 6, 2018 12:25
sqlx and ql testing
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/cznic/ql/driver"
"github.com/jmoiron/sqlx"
)
@danesparza
danesparza / tplinktest.go
Created August 4, 2018 17:28
TPLink smart plug energy meter working smoke test
package main
import (
"fmt"
"log"
"github.com/danesparza/tplink"
)
func main() {
@danesparza
danesparza / activity_and_queryplan.sql
Last active June 22, 2018 20:51
Finding high CPU queries in SQL server
select getdate() 'colltime',
c.session_id,
s.login_name,
@@SERVERNAME 'sqlnwname',
db_name(m.dbid) 'dbname',
s.status,m.blocked,
s.program_name,
s.host_name,
t.last_wait_type,
t.wait_resource,
@danesparza
danesparza / HandleAggregateException_UnitTest.cs
Last active June 22, 2018 21:04
Handling AggregateExceptions from Task execution
[TestMethod]
public void GetCSRInfo_BadOperation_ThrowsExceptionAndIsHandled()
{
// Arrange
var uscAPI = RestService.For<IUscApi>(_uscapiurl);
string csrCode = "404";
// Act
try
{
@danesparza
danesparza / main.go
Created September 10, 2017 00:32
Find hostname information and format for change
package main
import (
"fmt"
"io/ioutil"
"os"
"strings"
)
func main() {
@danesparza
danesparza / releasemanagement_cleanup.sql
Last active July 31, 2017 17:44
TFS releases cleanup
/*
This script is carries absolutely no guarantee and running it might cause your database
to end up in an unexpected state.
Run it completely at your own risk.
*/
/*
declare @releaseId int
set @releaseId = 2 -- Enter the id of the release to delete here
*/
@danesparza
danesparza / main.go
Created June 22, 2017 12:47
JWT test
package main
import (
"flag"
"fmt"
"github.com/dgrijalva/jwt-go"
"log"
"time"
)
@danesparza
danesparza / exec.go
Last active June 28, 2023 20:41
Go exec.Command example
package main
import (
"bytes"
"fmt"
"os/exec"
"strings"
)
func main() {
@danesparza
danesparza / viperlisttest.go
Last active June 12, 2017 12:42
Testing using viper with lists in config
package main
import (
"bytes"
"fmt"
"github.com/spf13/viper"
)
func main() {