Skip to content

Instantly share code, notes, and snippets.

View serverhorror's full-sized avatar

serverhorror serverhorror

  • Earth
View GitHub Profile
@serverhorror
serverhorror / HttpProxy.go
Created August 28, 2023 09:10 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@serverhorror
serverhorror / main.go
Last active January 12, 2023 20:58 — forked from cnunciato/main.go
Converting a pulumi.IDOutput to a string and using it in a lookup function
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
@serverhorror
serverhorror / 80x24.txt
Last active December 30, 2023 16:06
80 x 24 to preparea screencast
xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx
x x
x 80x24 x
x x
x x
x x
x x
x x
x x
x x
@serverhorror
serverhorror / example.ipynb
Created February 14, 2020 09:52 — forked from pelson/example.ipynb
Example of authenticating a GitHub app using jwt in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@serverhorror
serverhorror / aws-transfer-sftp.yaml
Created February 3, 2020 17:16 — forked from glnds/aws-transfer-sftp.yaml
CloudFormation template for AWS Transfer for SFTP
---
AWSTemplateFormatVersion: '2010-09-09'
Description: some-sftp-server
Parameters:
HostedZoneIdParam:
Type: String
Description: Hosted Zone ID
SFTPHostnameParam:
Type: String
CREATE SEQUENCE REVISION_SEQ
START WITH 1
INCREMENT BY 1
;
CREATE TABLE REVISION
(
REVISION_NR BIGINT NOT NULL ,
CREATED_AT TIMESTAMP WITH TIME ZONE ,
CREATED_BY UUID NOT NULL ,
from __future__ import print_function
import os
import sys
class model():
""" This is the django base model class, just for this example!
"""
// +build linux
package pb
//go:generate protoc -I . -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. stool.proto
//go:generate protoc -I . -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --grpc-gateway_out=logtostderr=true:. stool.proto
//go:generate protoc -I . -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --swagger_out=logtostderr=true:. stool.proto
func handleRead(l *zap.Logger, s storage.Interface, pbRead *pb.Read, rdr io.Reader) (io.Writer, error) {
l.Info("(pb.ReadRequest_Read)",
zap.String("type", fmt.Sprintf("%T", pbRead)),
zap.String("value",
fmt.Sprintf("%v", pbRead)),
)
rd, err := read.TranscribeFromPbRead(pbRead)
if err != nil {
return nil, err
}
@serverhorror
serverhorror / golang-buildTime-information.md
Last active July 26, 2019 13:59
How to embed information at build time
# PowerShell
go run `
  -ldflags="
    -X 'main.version=$(git name-rev --tags --name-only --always --no-undefined $(git rev-parse HEAD))' `
    -X 'main.commitInfo=$(if (git status --porcelain=v2 --untracked-files=no) {Write-Output "*"} else {Write-Output "clean"})' `
    -X 'main.buildTime=tomorrow.afternoon'" `
  .\playground\versionInject\main.go