This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ComputeHmac256(message string, secret string) string { | |
key := []byte(secret) | |
h := hmac.New(sha256.New, key) | |
h.Write([]byte(message)) | |
return base64.StdEncoding.EncodeToString(h.Sum(nil)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
#==================================================== | |
# | |
# Stand in for docker-compose 'extends' and env replacement | |
# ( currently not implemented for `docker stack deploy -f` ) | |
# | |
#==================================================== | |
use strict; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.9-alpine | |
# vi: ft=dockerfile | |
RUN apk update && apk add curl \ | |
git \ | |
protobuf \ | |
bash \ | |
make \ | |
openssh-client && \ | |
rm -rf /var/cache/apk/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
set -ueo pipefail | |
checkTimeout=6 | |
SEND_ERROR_MAIL=1 | |
cd "$WORK_DIR" | |
function send_to_slack { | |
local status=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Foobar | |
{ | |
public class RequestLogMiddleware | |
{ | |
public class LogData { | |
public IPAddress RemoteAddr {get;set;} | |
public string User {get;set;} | |
public int ResponseStatus {get;set;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tutils | |
import ( | |
"path" | |
"reflect" | |
"runtime" | |
"testing" | |
) | |
func AssertNotNil(t *testing.T, obj interface{}) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | |