View tricks.sh
#!/bin/bash | |
# start a new session | |
curl --data '{"desiredCapabilities":{"browserName": "chrome"}}' --silent http://localhost:4444/wd/hub/session | jq -r .sessionId |
View filli.sh
#!/bin/bash | |
# Sends foo bar and baz then back to you | |
(printf 'foo\nbar\nbaz\n' && cat) | $1 |
View indexed_sql_file_runner.go
package main | |
import ( | |
"bufio" | |
"database/sql" | |
"flag" | |
"fmt" | |
"path" | |
"strconv" | |
"strings" |
View nginx-json-log.conf
map $msec $millis { ~(.*)\.(.*) $2; } | |
map $time_iso8601 $time_iso8601_m { ~(.*)\+(.*) $1.$millis+$2; } | |
log_format json_combined escape=json | |
'{' | |
'"_ms": "$millis",' # Has to be here in order for timestamp to work. Wat | |
'"timestamp": "$time_iso8601_m",' | |
'"service": "sp-frontend",' | |
'"remote_addr":"$remote_addr",' | |
'"message":"[$status] $request_method $request_uri",' |
View httpclient.go
package client | |
import ( | |
"bytes" | |
"context" | |
"crypto/tls" | |
"encoding/json" | |
"fmt" | |
"github.com/pkg/errors" | |
"io" |
View useCheckbox.ts
import React, {useCallback, useMemo} from 'react'; | |
export const useCheckbox = (allValues: string[], selected: string[], onChange: (newSelection: string[]) => void) => { | |
const selectedStatesObj = useMemo(() => (selected || []).reduce((p, c) => ({ | |
...p, | |
[c]: true | |
}), {} as {[id: string]: boolean}), [selected]); |
View tutils.go
package tutils | |
import ( | |
"path" | |
"reflect" | |
"runtime" | |
"testing" | |
) | |
func AssertNotNil(t *testing.T, obj interface{}) { |
View Startup.vb
Imports Microsoft.Owin | |
Imports Microsoft.Owin.Security.OpenIdConnect | |
Imports Owin | |
Imports Microsoft.Owin.Security | |
Imports Microsoft.Owin.Security.Notifications | |
Imports Microsoft.Owin.Security.Cookies | |
Imports Microsoft.IdentityModel.Protocols.OpenIdConnect | |
Imports Microsoft.IdentityModel.Tokens | |
Imports System.Threading.Tasks |
View RequestLogMiddleware.cs
namespace Foobar | |
{ | |
public class RequestLogMiddleware | |
{ | |
public class LogData { | |
public IPAddress RemoteAddr {get;set;} | |
public string User {get;set;} | |
public int ResponseStatus {get;set;} |
NewerOlder